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

转载 2015年11月19日 22:44:43

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);

相关文章推荐

How can selenium web driver get to know when the new window has opened and then resume its execution

http://stackoverflow.com/questions/9188343/how-can-selenium-web-driver-get-to-know-when-the-new-wind...

How can I get a String from HID device in Python with evdev?

http://stackoverflow.com/questions/19732978/how-can-i-get-a-string-from-hid-device-in-python-with-ev...

How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?

直接下载下面的压缩包,然后解压出来,把\bin\win32\mexopts里面对应的文件拷贝到matlab2010a安装路径里面对应的文件夹下面即可!!   I have Visual Studi...

How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?

标题 How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?1 ...

How Do I Enable Remote Access To MySQL Database Server?

By default remote access to MySQL database server is disabled for security reasons. However, some ti...

How can I get my public IP address from the command line, if I am behind a router?

24down voteaccepted Assuming your system has 2 ethernet devices, eth0 and eth1 and eth0 is con...
  • aqzwss
  • aqzwss
  • 2016年03月16日 12:24
  • 380

How can I connect Unity to an SQL database in order to implement an MMO?

问: Hello, first of all I'd like to thank each and everyone who has dedicated their time into pr...
  • Koupoo
  • Koupoo
  • 2012年07月12日 15:16
  • 351
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How can i get access to a Highcharts chart through a DOM-Container
举报原因:
原因补充:

(最多只允许输入30个字)