i have two list of object in cllect points. i have to plot two lines each for a list during run time. i have tried creating new series for each through looping and adding data points. but only single line is generated that is iterated last in the loop. how it can be done.
What I have tried:
i have tried creating new series for each through looping and adding data points. but only single line is generated that is iterated last in the loop. how it can be done.
var chart = chart1.ChartAreas[0];
chart.AxisX.IntervalType = DateTimeIntervalType.Number;
chart.AxisX.Interval = 1;
chart.AxisY.Interval = 10;
chart.AxisX.Minimum = 0;
chart.AxisY.Minimum = 0;
chart.AxisX.Maximum = 10;
chart.AxisX.LabelStyle.Format = "";
chart.AxisY.LabelStyle.Format = "";
chart1.Series.Clear();
Random random = new Random();
foreach (var list in collectpoints)
{
Series series = new Series(list.key) { ChartType = SeriesChartType.Line, BorderWidth = 2, MarkerSize = 5, MarkerStyle = MarkerStyle.Square };
chart1.Series.Add(list.key);
chart1.Series[list.key].IsValueShownAsLabel = true;
chart1.Series[list.key].ChartType = SeriesChartType.Line;
chart1.Series[list.key].Color = Color.FromArgb(random.Next(256), random.Next(256), random.Next(256));
chart1.DataSource =list.point ;
chart1.Series[list.key].YValueMembers = "values";