A chart element could not be found in the series collection

Posted by  Samuel Fernandes
VB.Net 
 7534  View(s)
Ratings:
Rate this:
Hi Developers,

I'm implementing a chart element in my VB aspx application but it return as error. 

A chart element with the name 'test1' could not be found in the 'SeriesCollection'.

I'm trying as following

    'Create chart series
    Dim AnnualSeries As New Series
    AnnualSeries.Name = "test1"
    AnnualSeries.Points.DataBindXY(MonthArray, GraphVectorY)
    AnnualChart.Series("test1")("DrawingStyle") = "Emboss"

Thanks in advance for any recommendations or solutions.
 
  1. Re: A chart element could not be found in the series collection

    Hi Samuel,


    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.

Answer