derya
derya

Reputation: 65

Show x, y and curve names when cursor on the graph data in ZedGraph in C#

I try to show X,Y and the name of the curve which was drawn on the graph when cursor comes on it. I used

 zedGraphControl1.IsShowPointValues = true;

but it isn't enough. I need also curve name. When the cursor is on the curve in the graph information should be shown like that:

12/27/2010 12:09 AM, 49.94, ACTIVE_MW

Is it possible?

Upvotes: 3

Views: 3994

Answers (1)

PeskyGnat
PeskyGnat

Reputation: 2464

It is possible. You can add an event handler to the PointValueEvent event that gets fired when you mouse-over a point.

Something like:

this.zedGraphControl1.PointValueEvent += new ZedGraph.ZedGraphControl.PointValueHandler(this.zedGraphControl1_PointValueEvent);

private string zedGraphControl1_PointValueEvent(ZedGraph.ZedGraphControl sender, ZedGraph.GraphPane pane, ZedGraph.CurveItem curve, int iPt)
{
   return curve.Label.Text + " - " + curve.Points[iPt].ToString();
}

Upvotes: 9

Related Questions