1
Answer

problem in creating multiple line chart

Hi,
I want to create a multiple line chart but i get error
please help :\ 
this is my code:
try
{
chart1.Legends.Add("Concentration");
chart1.Series.Add("Concentration");
chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
for (int i = 0; i < prediction_year; i++)
{
//series.Points.AddXY(1393 + i, Concentration[i]);
chart1.Series[0].Points.AddXY(1393 + i, "Year", Concentration[i], "Concentration");
}
chart1.Series[0].IsVisibleInLegend = true;
chart1.Series[0].IsValueShownAsLabel = true;
chart1.Series[0].BorderWidth = 3;
chart1.Series[0].Color = Color.Red;
//*************
chart1.Legends.Add("NAAQS");
chart1.Series.Add("NAAQS");
chart1.Series[1].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
for (int i = 0; i < prediction_year; i++)
{
//series.Points.AddXY(1393 + i, Concentration[i]);
chart1.Series[1].Points.AddXY(1393 + i, "Year", avg_year_concentration, "Concentration");
}
chart1.Series[1].IsVisibleInLegend = true;
chart1.Series[1].IsValueShownAsLabel = true;
chart1.Series[1].BorderWidth = 3;
chart1.Series[1].Color = Color.Green;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}
and this is error
http://www.axgig.com/images/07571043081416266886.png
Answers (1)