how do you create a link on highcharts to open up pop up window with another chart

天涯浪子 提交于 2019-12-12 04:38:20

问题


I am creating charts with highcharts. I like to put a link or button in a chart (possibley left-top corner) and when clicked, I like to call a function that shows another chart in a pop up window. Basically how they do it in highchart demo site. When clicke on the x on the top-right corner, go back to the orintal chart.

I was thinking about placing a subtile and place a click event to it, as below:

   subtitle: {
            text: '<span id="node42" class="node-link">by Server</span>',
            align: 'left'
            },

I have created a small java script like below:

<script type="text/javascript">


    $('node42').observe('click', function(event) {
      alert('my click handler');
    });

</script>

when clicking on the node42 link, it is not doing anything, any ideas?


回答1:


I was able to do this:

subtitle: {
    useHTML: true,
    text: '<a href="#" onclick="myFunction()">by server chart</a>',
    align: 'left'
       },

and in my function

    <script type="text/javascript">
         function myFunction() {
           create the highchart syntax here
       }
  </script>


来源:https://stackoverflow.com/questions/17575082/how-do-you-create-a-link-on-highcharts-to-open-up-pop-up-window-with-another-cha

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!