在chart的属性中有两个重要的属性一个是ChartAreas ,另一个是Series
其中如果要清除当前绘制的图表时仅仅使用this.chart1.ChartAreas.Clear();会提示出现“CharAreaCollection”中找不到名为“C1”的图标元素,其中“C1”是我定义的一个ChartArea的名称,如下图所示:
chart出现的问题
有两种方式解决,
第一种
this.chart1.ChartAreas.Clear();
ChartArea chartArea2 = new ChartArea(“C1”);
this.chart1.ChartAreas.Add(chartArea2);
将之前的ChartArea原封不动的保留
第二种
先将其中的Series清除掉
this.chart1.Series.Clear();
在清除掉chartAreas
this.chart1.ChartAreas.Clear();

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2021-12-29
  • 2021-08-16
  • 2021-12-26
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2021-07-08
  • 2021-05-22
  • 2021-11-21
  • 2021-09-02
  • 2021-08-22
  • 2022-12-23
相关资源
相似解决方案