1

TL;DR: Have a lot of points, dataGrouping is on, how do I update an individual point?

I'm trying to make a HighCharts/HighStock chart that shows "per minute" averages over time. I do this by loading in a bunch of data that represents the "counts" and there is one record for every minute. Then, depending on how much chart data I have, I use the HighCharts dataGrouping with average approximation method to group all of the data.

Here's the kicker, I would like the most recent minute to update every second with its current count. Then, when we're on to the next minute, add a point and keep going. Typically I would do something like this to do that:

chart.series[0].data[99].update(newVal)

The problem is, data is empty by design when dataGrouping is on. I can see some point objects in series.points but updating them doesn't seem to do what I intend. I can also access and update the original data at series.options.data but updating it there doesn't seem to update the chart.

Here is a basic fiddle demonstrating the problem. I have ~30 minutes of random consecutive data there and I have forced it to group in 5 minute windows. Anyone who can make an individual point update when I press that button gets my gratitude and a shiny green check mark next to your answer.

4

1 回答 1

1

http://jsfiddle.net/kZRCa/2/

$('#button').click(function() {
    var chart = $('#container').highcharts();
    var series = chart.get("S1");
    var _data = series.options.data;
    // try and make a point (ANY POINT) update
    _data[10][1] = 200;
    series.setData(_data);
});

编辑:忘了提到我也给了这个系列一个ID,所以它更容易get()

于 2013-09-27T17:39:53.443 回答