[英]How to clear plotted values in points chart?
In my C# application ,using a points chart that is working fine. 在我的C#应用程序中,使用可以正常工作的点图。 But if I try to clear all plotted points it is not clearing. 但是,如果我尝试清除所有绘制的点,则不会清除。 How to do this? 这个怎么做?
Refer below the code, 请参阅下面的代码,
series1.Points.AddXY(1, 10);//Plotting the points in chart
series2.Points.AddXY(2, 20);
chart1.Series.Clear(); //I tried to clear using this code
If i tried the above code for clear , it is removing entire chart but I want to clear only the plotted points. 如果我尝试了上述代码进行清除,它将删除整个图表,但我只想清除绘制的点。
To clear all the points in the series: 要清除系列中的所有要点:
chart1.Series[0].Points.Clear();
To remove the first point in the series: 删除系列中的第一点:
chart1.Series[0].Points.RemoveAt(0);
To clear all the points in all series: 要清除所有系列中的所有要点:
foreach(var series in chart1.Series)
{
series.Points.Clear();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.