Formatting tooltip on Zedgraph
Asked Answered
C

1

6

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?

Chockablock answered 14/8, 2012 at 14:5 Comment(0)
B
9

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.

Bangka answered 14/8, 2012 at 16:12 Comment(2)
I dnt think this is what i want.i know how to change the string.but i want to change the style of tooltip like:its balloon property or adding header to tool tip which we can do for normal tooltips. Can't we do it for zedgraph tooltip.Chockablock
hi @marty.. may i know how to patch the ZedGraph? i have downloaded the patch file but no idea how to patch it to my ZedGraph dll. thanks.Thilde

© 2022 - 2024 — McMap. All rights reserved.