问题
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