TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
maryam mohammadi
NA
26
4.4k
chart+object reference not set...error
Aug 26 2014 3:38 PM
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);
}
Reply
Answers (
5
)
Tips for beginners
Remove check box column from datagridview using c#