I want to dynamically update the data for every series I have in a line chart (Highcharts.js). Currently, I'm doing it by manually passing new data to a series using the setData method:
$(document).ready(function() {
$(chart_id).highcharts({
chart: chart,
title: title,
credits: credits,
xAxis: {},
Axis: yAxis,
legend: legend,
series: series
});
var chartz = $(chart_id).highcharts();
$('#data-labels').click(function () {
chartz.series[0].setData([129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4,25,29],true,true,true);
});
What I would like to do is update:
chartz.series[i]
Where is the index of each individual series (I have about 36 and new ones are added all the time)
How do I code and implement a javascript for loop that counts the series length and passes into the series[i].setData variable? I'm very inexperienced in JavaScript, so I'm not really sure where to even begin or where to place this function? I'm guessing it will look something like (where i < is pseudo code):
for (var i = 0; i < "series length + 1"; i++)
Aucun commentaire:
Enregistrer un commentaire