i want manipulate var series before configure highchart-code.
but 68 series!! instead of 2 series defined before.
what can error?
var series; function refresher() { series = "[{ name = 'test1', data = data[0]},{ name = 'test', data = data[1]}]"; $.getjson(url, function(data) { chart = new highcharts.stockchart ({ chart: { renderto: 'container', zoomtype: 'x', type: 'line', width: 900 }, legend: { enabled: true, verticalalign:'bottom' }, title: { text: 'you see data of last measured hour!' }, credits: { enabled: false }, xaxis: { type: 'datetime', title: { text: 'time' } }, yaxis: { title: { text: 'hallo' } }, rangeselector:{ enabled: false }, navigator : { enabled: false }, series: series, tooltip: { xdateformat: '%e. %b.%y %h:%m:%s', valuedecimals: 2, }, exporting: { enabled: true }, }); // format y-data. highcharts.numberformat(this.y, 2, '.', ','); }); };
the problem in series
variable.
1st of all, it's string, , not object.
i don't know why using if want string, you'll have eval
when given series
object:
... series: eval(series) ...
also, it's not:
series = "[{ name = 'test1', data = data[0]},{ name = 'test', data = data[1]}]"
the equal signs incorrect. has be:
series = "[{ name: 'test1', data: data[0]},{ name: 'test', data: data[1]}]"
(i've replaced equal signs colons.)
Comments
Post a Comment