Skip to content

Instantly share code, notes, and snippets.

@dogrunjp
Created March 26, 2014 06:23
Show Gist options
  • Save dogrunjp/9777753 to your computer and use it in GitHub Desktop.
Save dogrunjp/9777753 to your computer and use it in GitHub Desktop.
Highchartsのデータをアップデートする方法はdestroy()〜とredraw()の2種類ある。destroy()して再描画した方が若干速いらしい。いずれもD3.jsのアップデートよりわかりやすい。(普通にjQueryなので…) ※マルチデータなline chartの例
##destro()〜なアップデート
#chart = new Highcharts.Chart(options)がすでに描画されているケースでは
$.getJSON('hoge.json',function(data){
chart.destroy()
options.xAxis = data[1];
options.series = data[0]['datas'];
chart = new Highcharts.Chart(options);
});
##redraw()を利用したアップデート
$.getJSON('hoge.json',function(data){
chart.series.setData(data);
chart.redraw();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment