I have a bit different kind of requirement for ZedGraph.
I want to create the curves on the ZedGraph pane when user clicks on the ZedGraph pane. Also, I have other graphs plotted on that pane. But i want that whenever user clicks on the zedGraph area, we get the co-ordinates where user have clicked and i draw a straigth line on that clicked co-ordinate.
I have used the MouseCLick event alogn with the FindNearestObject method like the following way:
private void zedGraph_RenderedTrack_MouseClick(object sender, EventArgs e)
{
MouseEventArgs xx = (MouseEventArgs)e;
object nearestObject;
int index;
this.zedGraph_RenderedTrack.GraphPane.FindNearestObject(new PointF(xx.X, xx.Y), this.CreateGraphics(), out nearestObject, out index);
if (nearestObject != null)
{
DrawALine(xx.X, Color.Red, true);
}
}
But using this, ZedGraph search for some curve and find the nearest points and then plot the line but i want that the line be drawn where ever the user clicks. Is there any method to do so?