We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

NullReferenceException adding series to Chart

Hi,
I am trying to plot a multi-y graph and I am getting a NullReferenceException when I try to add the series to the chart control. The code is very simple:

ChartSeries series;
for(int i=0;i<3;i++)
{
series = this.ChartWebControl1.Model.NewSeries("MultiY" + i.ToString(), ChartSeriesType.Line);

Random autoRand = new Random();
for (int j=0; j<100; j++)
{
series.Points.Add(j, j * autoRand.Next());
}

this.ChartWebControl1.Series.Add(series);
}

I do have a Pie Chart and Bar Chart working just fine with similar setups.

I did notice that while tracing the code I get a "series.BackColor threw an exception of type 'System.IndexOutOfRangeException'"

Thanks.
David.



1 Reply

AD Administrator Syncfusion Team March 19, 2008 09:54 AM UTC

Hi David,

Thank you for your interest in Syncfusion Products.

I am afraid I was unable to reproduce the issue. Please refer the sample in this link
http://websamples.syncfusion.com/samples/Chart.Web/6.1.0.34/72390/main.htm where the code you have given renders Line Chart without throwing an exception.

Can you reproduce the issue in this sample so that we can work in depth and send a better solution?

Regards,
Anupama


Loader.
Live Chat Icon For mobile
Up arrow icon