ffb.boy.30
Member
- Joined
- Jan 18, 2017
- Messages
- 5
- Programming Experience
- 1-3
Hi,
I'm creating a class that draw multiple serie on a chart.
Now I would like to pass a parameters to my class to create the number of series received byt the class.
Actually I 've created a dynamic Chart but I stuck to create the array of series.
The code to create a series is
And I tought I could do something like this
But it don't work because the ChartSeries array is empty I start the loop.
If someone have a tips to share.
Thanks for your help
I'm creating a class that draw multiple serie on a chart.
Now I would like to pass a parameters to my class to create the number of series received byt the class.
Actually I 've created a dynamic Chart but I stuck to create the array of series.
The code to create a series is
C#:
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
series1.ChartArea = "ChartArea1";
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
series1.Legend = "Legend1";
series1.Name = "Serie 1";
And I tought I could do something like this
C#:
System.Windows.Forms.DataVisualization.Charting.Series[] ChartSeries = new System.Windows.Forms.DataVisualization.Charting.Series[10];
Array.Resize(ref ChartSeries, NbSeries);
for (int i = 0; i < NbCharts; i++)
{
ChartSeries[i].ChartArea = "ChartArea1";
ChartSeries[i].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
ChartSeries[i].Legend = "Legend";
ChartSeries[i].Name = "Serie Number" + Convert.ToString(i+1);
this.DrawChartInfo.Series.Add(ChartSeries[i]);
}
But it don't work because the ChartSeries array is empty I start the loop.
If someone have a tips to share.
Thanks for your help