仅使用JavaScript更新现有Highstock图表的数据

我正在编辑一个站点而我无法访问原始代码,我所能做的就是将代码附加到它的末尾。 我无法访问PHP(我认为无论如何我都不需要)。

这是现有的代码:

//HIGHSTOCKCHART (function () { var highstockchart = enoro.namespace("orchard.standard.consumption.highstockchart"); highstockchart.defaults = { chart: { renderTo: null, }, credits: { enabled: false }, navigator: { series: { includeInHtmlTableExport: false } }, rangeSelector: { buttonTheme: { width: 70, height: 20 }, inputEnabled: false, buttons: [ { type: 'day', count: 1, text: 'Dag' }, { type: 'week', count: 1, text: 'Uke' }, { type: 'month', count: 1, text: 'Måned' }, { type: 'all', text: 'All' } ], selected: 2 }, yAxis: [ { id: 'yAxis-consumption', title: { text: 'kWh' } } ], title: { text: null }, series: [ { id: 'thisyear', name: null, data: null, type: 'spline', pointStart: null, pointInterval: 3600 * 1000, dataGrouping: { approximation: "sum", enabled: true }, tooltip: { valueDecimals: 1, valueSuffix: " kWh" } } ] }; }()); (function () { var consumption = enoro.namespace("orchard.standard.consumption"); consumption.init(); }());

使用以下代码我可以从URL检索新数据,但我不确定如何应用它并重绘图形。 请记住,我无法编辑上面的任何代码:

 $.getJSON('*url*', function(data) { // data.data gives the following result: [3.0,2.0,3.0,5.0,8.0] // How do I apply this data and redraw the graph? }); 

目前,该图从属性data-serie-data =“[4.0,4.0,3.0,4.0,3.0]”中绘制值。

如何将data.data应用于图形并重新绘制?

编辑:

我尝试了以下,但这不起作用:

 highstockchart.series[0].setData(data.data,true); 

在/ Meter / Consumption页面上的Chrome控制台中,您应该可以粘贴以下内容,它应突出显示最高的4个值: http : //pastebin.com/4RzYXcBh