Hello
I want to make a chart with following code
but I get error for specified line!
please help! :(
private void button3_Click(object sender, EventArgs e)
{
chart1 = new Chart();
ChartArea chartArea1 = new ChartArea();
chart1.ChartAreas.Add(chartArea1);
Series series1 = new Series();
chart1.Series.Add(series1);
for (int i = 0; i < prediction_year; i++)
{
series1.Points.Add(Concentration[i]).AxisLabel = Convert.ToString(1393 + i);
}
chart1.Series[0].ChartType = SeriesChartType.Line;
chart1.Location = new System.Drawing.Point(30, 40);
chart1.Size = new System.Drawing.Size(500, 300);
chart1.Legends.Add("hi");
chart1.Series[0].LegendText = "concentration";
chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1;
this.Controls["gbxChart"].Controls.Clear();
this.Controls["gbxChart"].Controls.Add(chart1);
}
Loading

R J192 reputationPosted Aug 26, 2014, 11:52 AM EDT
R J192 reputationPosted Aug 26, 2014, 11:42 AM EDT
maryam mohammadi28 reputationPosted Aug 26, 2014, 11:48 AM EDT
maryam mohammadi28 reputationPosted Aug 26, 2014, 12:02 PM EDT
R J192 reputationPosted Aug 26, 2014, 12:20 PM EDT
identify why this.Controls["gbxChart"] is null from your actual code.