Highcharts 3.0.1
Users can use the highcharts plugin
var chart=$("#container").highcharts();
海图2.3.4
从Highcharts.charts数组中读取,对于2.3.4及更高版本,可以从<div>
上的数据中找到图表的索引
var index=$("#container").data('highchartsChart');
var chart=Highcharts.charts[index];
All versions
按容器ID跟踪全局对象/ map 中的图表
var window.charts={};
function foo(){
new Highcharts.Chart({...},function(chart){
window.charts[chart.options.chart.renderTo] = chart;
});
}
function bar(){
var chart=window.charts["containerId"];
}
Read Mode @ Highcharts Tips - Accessing Chart Object From a Container ID
附笔.
Some additions were made in the newer versions of Highcharts since writing this answer and have been taken from answers from @davertron, @Moes and @Przy, please upvote their comments/answers as they deserve the credit for these. Adding them here as this accepted answer would be incomplete without these