This is a migrated thread and some comments may be shown as answers.

RadChart Multiple Series with DateTime labels on Xaxis

1 Answer 104 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Prasoon
Top achievements
Rank 1
Prasoon asked on 30 Oct 2013, 11:40 AM
Hi,
how it's possible create a chart with multiple line series?

for example in my db I have:

Datetime                     Value
06/10/2011 06:00              8
06/10/2011 06:10             12
06/10/2011  06:15            9
06/10/2011  06:18            6
06/10/2011   06:21          9

I want create multiple line series for selected datetime Range where the x-axis is DateTime and the y-axis Value.

I have tried like this but its not plotting its showing only empty series..
                series = new ChartSeries();
                    series.Type = ChartSeriesType.Line;
                    series.Name = "RTD"; series.Clear();
                         ChartSeriesItem item = new ChartSeriesItem();

                 item.YValue = Convert.ToDouble(Sqlds.Tables[0].Rows[i][0]);
                                series.Items.Add(item);
                chart1.PlotArea.XAxis[index].TextBlock.Text = DateTime;
           //Axis 
            chart1.PlotArea.YAxis.AxisLabel.TextBlock.Text = "DateTime";

            chart1.PlotArea.XAxis.AutoScale = false;
            chart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.LongDate;
            chart1.PlotArea.XAxis.Appearance.CustomFormat = "mm/dd/yyyy hh:mm:ss";
            chart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 90;
 
            //Axis Y
            chart1.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Value";
            chart1.Series.Clear();
            chart1.Series.Add(series2);
           chart1.Series.Add(series1);
            chart1.Series.Add(series);
thanks

1 Answer, 1 is accepted

Sort by
0
Stamo Gochev
Telerik team
answered on 04 Nov 2013, 07:18 AM
Hello Prasoon,

I prepared a sample page where I use RadChart with two Line series and populate them with some random items.

If you wan tto know how you can create a chart with more than one series (in general), you can use a "for" loop and create a single series on each iteration and then add it to the chart's Series collection. On the other hand, if you have problems implementing a specific scenario, with multiple Line series, could you explain it to me in short, so I can give you some suggestions? You can also modify my page to show me your case and send it back to me.

Regards,
Stamo Gochev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Chart (Obsolete)
Asked by
Prasoon
Top achievements
Rank 1
Answers by
Stamo Gochev
Telerik team
Share this question
or