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

查看:13
本文介绍了.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();

然后重新添加系列,如:

and then re-add the series like:

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?

推荐答案

这应该有效:

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

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

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