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

For loop in Kendo Chart Series.

1 Answer 515 Views
Charts
This is a migrated thread and some comments may be shown as answers.
crazy05
Top achievements
Rank 1
crazy05 asked on 14 Jan 2015, 05:19 PM
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]


1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 16 Jan 2015, 03:18 PM
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!
 
Tags
Charts
Asked by
crazy05
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or