In my WPF application for Chart Building I'm trying to use WinForms System.Windows.Forms.DataVisualization.Charting;
I have the following code:
private void build()
{
for(int i = 0; i< boundData.Count; i++)
{
var chart = new Chart();
var ser = new Series();
ser.Name = "Series1";
ser.ChartType = SeriesChartType.Bar;
ser.Color = System.Drawing.Color.Blue;
chart.Series.Add(ser);
charts.Add(chart);
for (int j = 0; j < boundData[i].Count; j++)
{
charts[i].Series["Series1"].Points.AddXY(j, boundData[i][j]);
}
}
//Just for tesing Purposes
charts[1].Invalidate();
charts[1].SaveImage("met.png", ChartImageFormat.Png);
}
'boundData' has the following structure
List<List<int>>:
List<int> : [ 1,2,3,4,5,6,... ];
List<int> : [ 1,2,3,4,5,6, ... ];
...
According to debagger the 'Series' property has points.
What I want to do is to build a chart and save it as image. The image saved is just nothing (empty) Can anybody please point what I'm doing wrong or suggest another way of building charts?