Created
March 26, 2014 06:23
-
-
Save dogrunjp/9777753 to your computer and use it in GitHub Desktop.
Highchartsのデータをアップデートする方法はdestroy()〜とredraw()の2種類ある。destroy()して再描画した方が若干速いらしい。いずれもD3.jsのアップデートよりわかりやすい。(普通にjQueryなので…)
※マルチデータなline chartの例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##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