0

I have a graph which has live data feeding in, but the chart only tracks or follows the data line if the navigator is enabled.

I am unsure if this is a feature or is it a bug.

On the JSFiddle, notice how it doesn't track, but as soon as you change enabled: false to enabled: true, on line 43, it instantly starts tracking.

http://jsfiddle.net/6eso1hgy/1/

Is it possible to make it have the tracking behavior without a navigator?

Dolan
  • 1,519
  • 4
  • 16
  • 36

2 Answers2

0

I don't know if you really need Highstock. If not then you can change the code to just Highcharts and then remove all unnecessary code and add the following:

series: [{
  marker: {
    radius: 0
  },
...

Fiddle

Core972
  • 4,065
  • 3
  • 31
  • 45
0

You can achieve it using xAxis.setExtremes() method:

Code:

events: {
  load: function() {
    // set up the updating of the chart each second
    var series = this.series[0];
    var chart = this;
    setInterval(function() {
      NewTime = (new Date()).getTime(); // current time
      var x = NewTime,
        y = Math.round(Math.random() * 10);

      series.addPoint([x, y], false, false, false); //redraw shift animation

      chart.xAxis[0].setExtremes(
        chart.xAxis[0].min + 1000,
        chart.xAxis[0].max + 1000,
        true,
        false
      );
    }, 1000);
  }
}

Demo:

API reference:

Wojciech Chmiel
  • 7,302
  • 1
  • 7
  • 16
  • This is a little bit of a hack with `setInterval` so I am not too happy with this answer. Ideally I wan't it to just work without any faffing about, but I will try it! – Dolan Jun 07 '19 at 17:51