Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I need to show curve name in cursor tooltip when cursor on it in zedgraph. I can show x and y values of the curve which is under the cursor with

zedGraphControl1.IsShowPointValues = true;


function.But I also need curve name. How can I accomplish using c# ?
Please help :(
Posted
Updated 5-May-11 21:43pm
v2
Comments
Sergey Alexandrovich Kryukov 6-May-11 9:59am    
Tag it! It must be Forms.
--SA

To customize the tooltip text, you must subscribe the PointValueEvent:

C#
{
    zedGraphControl1.PointValueEvent += new ZedGraph.ZedGraphControl.PointValueHandler(zedGraphControl1_PointValueEvent);
    ...
}

string zedGraphControl1_PointValueEvent(
    ZedGraph.ZedGraphControl sender, ZedGraph.GraphPane pane,
    ZedGraph.CurveItem curve, int iPt)
{
    return return "X = " + curve[iPt].X.ToString() + " Y = " + curve[iPt].Y.ToString() + " Name = " + curve.Label.Text;
}
 
Share this answer
 
v4
Comments
Member 7755322 6-May-11 4:24am    
Thank you, yes it is what I want :) but this time, curve point values disappeared. How can we show x value,y value and curve name together?
Olivier Levrey 6-May-11 4:32am    
I updated my answer to print x and y as well. Please see.
If this solves your problem, then you can accept my answer :)
Member 7755322 6-May-11 4:38am    
you are the best! thank you :)
Olivier Levrey 6-May-11 4:39am    
You are welcome :)
Sergey Alexandrovich Kryukov 6-May-11 10:05am    
I hope it works, my 5, but I think the simple and not intrusive regular Tooltip technique will do.
Please see my answer.
--SA
I think the regular technique of using System.Windows.Forms.ToolTip. You can do it all just using System.Windows.Forms.ToolTip.SetTooltip.

(I hope you're using System.Windows.Forms? Please, always tag it in your question.)

For more advanced case, see my past answer:
how to make combobox tooltips disaper once mouse is hovered away from a item in combo[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900