How can i get access to a Highcharts chart through a DOM-Container

Highcharts 3.0.1

Users can use the highcharts plugin

var chart=$("#container").highcharts();

Highcharts 2.3.4

Read from the Highcharts.charts array, for version 2.3.4 and later, the index of the chart can be found from the data on the div

 var index=$("#container").data('highchartsChart');
 var chart=Highcharts.charts[index];

All versions

Track charts in a global objec/map by container id

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 @ http://ahumbleopinion.com/highcharts-tips-accessing-chart-object-from-container-id/


创建chart:

var chart = new Highcharts.Chart(options);
// Using an element reference
var otherOptions = {
chart: {
renderTo: document.getElementById('container');
},
// ...
}
var otherChart = new Highcharts.Chart(options);

阅读更多
文章标签: jquery
个人分类: jquery
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

How can i get access to a Highcharts chart through a DOM-Container

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭