Reputation: 923
I have a strange thing happening while using ZedGraph.
I am using the same item to add multiple curves. Like:
ZedGraph LineItem curve_3;
curve_3 = pane.AddCurve("", xx_1, yy, xxyy);
I call the above lines multiple times to add multiple points. But when I remove the curve, only the last added curve gets removed and left all stays on the pane.
this.zedGraph_RenderedTrack.GraphPane.CurveList.Remove(curve_3);
I am not finding a way that will clear all the curves added. Is there a to do it?
My actual requirement is that I have to add the different lines dynamically on the pane, but I don't need to display the label information and all of them should be plotted by a single click and removed by a single click.
Upvotes: 3
Views: 3448
Reputation: 5083
You are holding only the last curve in this code:
ZedGraph LineItem curve_3;
curve_3 = pane.AddCurve("", xx_1, yy, xxyy);
Use collection like List<LineItem> to remember all the curves.
List<LineItem>.foreach(r => this.zedGraph_RenderedTrack.GraphPane.CurveList.Remove(r);
)
Upvotes: 4
Reputation: 15971
If you want to remove all curves from your graph pane, simply use the CurveList.Clear()
method:
this.zedGraph_RenderedTrack.GraphPane.CurveList.Clear();
Upvotes: 0