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

前端 未结 9 828
轮回少年
轮回少年 2020-12-02 11:55

When i render a highcharts-chart to a div container, how can i get access to the chart object through the div-Container? i dont want to make the chart variable global.

9条回答
  •  死守一世寂寞
    2020-12-02 12:39

    Simply with pure JS :

    var obj = document.getElementById('#container')
        Highcharts.charts[obj.getAttribute('data-highcharts-chart')];
    

提交回复
热议问题