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
Farhan Shariff
NA
933
241.6k
Renaming and saving file each time code executes
Mar 31 2014 10:11 AM
I have a DataTable
new
Old
New_1
plot
2.1
1.1
4.3
0.60
0.4
1.2
2.1
0.12
3.1
2.3
3.2
0.29
I want to plot chart's with: 1new vs plot , Old vs plot, new_1 vs plot1 and save each of plots as image
s
thus creating multiple chart images one for each column.
I want to use column index, the index of plot column is fixed.
I think if I am able to save image with different names each time and loop the column index ,I will be able to generate charts for each column.
for(int g=0; g< resultDt.Columns.Count-1;g++)
{
Chart chart = new Chart();
chart.DataSource = resultDt;
chart.Width = 800;
chart.Height = 550;
//create serie...
Series serie1 = new Series();
serie1.Name = "Serie1";
serie1.Color = Color.FromArgb(112, 255, 200);
serie1.BorderColor = Color.FromArgb(164, 164, 164);
serie1.ChartType = SeriesChartType.Line;
serie1.XValueMember = resultDt.Columns[0].ColumnName;
serie1.YValueMembers = "plot";
chart.Series.Add(serie1);
//create chartareas...
ChartArea ca = new ChartArea();
ca.Name = "ChartArea1";
ca.BackColor = Color.White;
ca.BorderColor = Color.FromArgb(26, 59, 105);
ca.BorderWidth = 0;
ca.BorderDashStyle = ChartDashStyle.Solid;
ca.AxisX = new Axis();
ca.AxisY = new Axis();
//ChartArea ca = new ChartArea("main");
ca.BackColor = System.Drawing.Color.FromArgb(64, System.Drawing.Color.White);
chart.ChartAreas.Add(ca);
//databind...
chart.DataBind();
//save result...
chart.SaveImage(@"C:\myChart.png", ChartImageFormat.Png);
}
Reply
Answers (
4
)
Three dimensional array
Webcam Photo without using picture box and capturing vidoes