Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting tooltip on Zedgraph

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?

like image 458
Shobha Singh Avatar asked Aug 14 '12 14:08

Shobha Singh


1 Answers

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.

like image 97
Marty Avatar answered Sep 29 '22 03:09

Marty