For loop in Kendo Chart Series.

2 posts, 0 answers
  1. crazy05
    crazy05 avatar
    74 posts
    Member since:
    Sep 2014

    Posted 14 Jan 2015 Link to this post

    Hello,

    I am building my own series based out of JSON data. I am creating multiple series in same Axis. 

    I am binding series using for loop. I am giving series as below. 

     series: [{              
                    data: Series[0],
                    name: "Name",
                    field: "Id",
                    
                },
                {
                    data: Series[1],
                  name: "Email",
                    field: "Id",
                }]

    For each series I am giving Series[0], Series[1], Series[2] and so on. Is there any way, we can use for loop in series based on count of Series[i]


  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 16 Jan 2015 Link to this post

    Hi,

    You can always loop the source data and construct the series externally:
    var series = [];
    for (var i = 0; i < Series.length; i++) {
      series.push({
        data: Series[i],
        name: "Name", // or lookup the name
        field: "Id"
      });
    }

    $("#chart").kendoChart({
        series: series,
        ...
    });


    I hope this helps.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top