.net图表清除和重新添加 [英] .net chart clear and re-add

查看:101
本文介绍了.net图表清除和重新添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图表,我需要清除它,以填充它与不同的值。
该图表有3个系列,都在.aspx页面中定义。

I have a chart and I need to clear it in order to populate it with different values. The chart has 3 series, all defined in the .aspx page.

问题是当我调用

chart.Series.Clear();

,然后重新添加系列:

chart.Series.Add("SeriesName");

它不保留3个初始系列的任何属性。
如何清除值并保留系列属性?

It doesn't keep any of the attributes of the 3 initial series. How to just clear the values and keep the series attributes?

推荐答案

b
$ b

This should work:

foreach(var series in chart.Series) {
    series.Points.Clear();
}

这篇关于.net图表清除和重新添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆