3

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.

4

2 回答 2

4

您只保留此代码中的最后一条曲线:

ZedGraph LineItem curve_3;
curve_3 = pane.AddCurve("", xx_1, yy, xxyy);

使用 List<LineItem> 之类的集合来记住所有曲线。

List<LineItem>.foreach(r => this.zedGraph_RenderedTrack.GraphPane.CurveList.Remove(r);
)
于 2012-09-12T11:58:57.997 回答
0

如果要从图形窗格中删除所有曲线,只需使用以下CurveList.Clear()方法:

this.zedGraph_RenderedTrack.GraphPane.CurveList.Clear();
于 2012-09-12T12:11:23.427 回答