简体   繁体   English

使用ZedGraph的多条曲线

[英]Multiple curves using ZedGraph

I have a strange thing happening while using ZedGraph . 使用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. 我的实际要求是我必须在窗格上动态添加不同的行,但我不需要显示标签信息,只需单击即可绘制所有标签信息并通过单击删除。

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>之类的集合来记住所有曲线。

List<LineItem>.foreach(r => this.zedGraph_RenderedTrack.GraphPane.CurveList.Remove(r);
)

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

this.zedGraph_RenderedTrack.GraphPane.CurveList.Clear();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM