saGii
saGii

Reputation: 477

highstock chart when loading via ajax has jerky behavior

I'm using HighStock api and setExtremes callback to load data from server.

When I change the extremes, the whole chart just jerks to some values (x axis changes so do the lines) until the data is returned from the server.

It looks highly unprofessional, as if an error corrected on runtime.

Any change the 'loading' comes and then the new data comes smoothly?

here's the fiddle

if !is_code_accompanied
  stack_overflow = doesnt_let_me_post()
end

Upvotes: 0

Views: 81

Answers (1)

benjaminz
benjaminz

Reputation: 3228

This works for me:

function getDataButNoJerky() {
  ....
  var chart = $('#container').highcharts(); // get our chart
  // if you have multiple series
  for (var i = 0; i < chart.series.length - 1; i++) {
    chart.series[i].setData([]);
  }

  chart.showLoading('Loading....');
  // request new data source here
  $.getJSON('/data', function (data) {
    // repopulate your chart with the data returned
  }
}

Upvotes: 2

Related Questions