Cannot add more than one line in a chart

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    2 posts
    Member since:
    May 2016

    Posted 10 May Link to this post

    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;
                }

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3596 posts

    Posted 12 May Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top