vb.net 在系列集合中找不到图表元素
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17032577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A chart element could not be found in the series collection
提问by E Crux
I'm attempting to create a chart element and keep getting an error:
我正在尝试创建图表元素并不断收到错误消息:
A chart element with the name 'test1' could not be found in the 'SeriesCollection'.
在“SeriesCollection”中找不到名为“test1”的图表元素。
for the corresponding code:
对于相应的代码:
'Create chart series
Dim AnnualSeries As New Series
AnnualSeries.Name = "test1"
AnnualSeries.Points.DataBindXY(MonthArray, GraphVectorY)
AnnualChart.Series("test1")("DrawingStyle") = "Emboss"
This is run in a script inside the aspx page. Any ideas?
这是在 aspx 页面内的脚本中运行的。有任何想法吗?
回答by DaveShaw
You need to add the Series to the Chart.
您需要将系列添加到图表中。
AnnualChart.Series.Add(AnnualSeries)
My VB might be a bit rusty, but hopefully you get the idea.
我的 VB 可能有点生疏,但希望你能明白。

