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

Cannot add more than one line in a chart

1 Answer 50 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 10 May 2016, 03:56 PM

I populate a Dataset whith multiple data tables of results, and then I loop through each of the tables to reveal my results.

 

However only the first datatable is used the others are ignored.

 

I have made sure that the lineseries name is the same as the datatable ?

 

Any ideas please ??

 

 

 

foreach (DataTable table in myRunData.Tables)
            {
              
                LineSeries currentLine = new LineSeries();
                lineSeries1.Name = table.TableName;
                lineSeries1.LabelsAppearance.Visible = true;
                lineSeries1.LabelsAppearance.DataFormatString = "y";

                lineSeries1.TooltipsAppearance.Color = System.Drawing.Color.Blue;
                lineSeries1.TooltipsAppearance.DataFormatString = "{0}";

                lineSeries1.DataFieldY = "TimeInSeconds";

                lineSeries1.TooltipsAppearance.ClientTemplate = " #= kendo.parseInt(value/60) #:#= (value%60) # minutes";
                lineSeries1.LabelsAppearance.ClientTemplate = " #= kendo.parseInt(value/60) #:#= (value%60) # minutes";

                lineSeries1.TooltipsAppearance.DataFormatString = "{0:hh:MM:ss}";
                RadHtmlChart1.PlotArea.Series.Add(lineSeries1);
            }
            RadHtmlChart1.DataSource = parkRunData;
            RadHtmlChart1.DataBind();
            if (!RadHtmlChart1.Visible)
            {
                RadHtmlChart1.Visible = true;
            }

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 12 May 2016, 10:42 AM

Hello Andrew,

RadHtmlChart takes only the first table in a DataSet.

If you need more data, I suggest you look into the following options:

  • use another data structure
  • merge all the data in a single table, RadHtmlChart requires columns for the fields so it is rather easy to append data
  • consider creating the entire chart, together with its data items programmatically by looping through the data source, instead of using data binding. This will simply require a nested loop to populate each series


Regards,

Marin Bratanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Chart (HTML5)
Asked by
Andrew
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or