I want to format my tool tip that I used to display graph and point information on PointValueEvent on Zedgraph.
I know how to format normal tool tip but in this case zedgraph doesn't have tool tip property. Point value event automatically shows tool tip.
How to formatt that tool tip?
There are a couple of different ways of doing this.
Option 1 is to use the PointPair's Tag property when setting up your data. If the Tag is a string, it will be displayed as a tooltip for the point.
PointPair pp = new PointPair(....);
pp.Tag = "This is a custom tooltip";
Option 2 is to subscribe to the graph control's PointValueEvent and provide a custom value in your event handler.
graph.PointValueEvent += OnPointValueRequested;
...
private string OnPointValueRequested(object sender, GraphPane pane, CurveItem curve, int pointIndex)
{
PointPair point= curve[pointIndex];
string tooltip = String.Format("({0}, {1})", point.X point.Y);
return tooltip;
}
Also keep in mind that there is a bug with tooltip CPU usage on Vista and above. You may need to patch your copy of ZedGraph to fix it if you haven't already done so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With