I want to launch an event when clicking on the tooltip of highcharts. I'm using highcharts in Ionic/Angular project. Here is an example:
Highcharts.chart('container', {
title: {
text: 'Tooltip footer format demo'
},
subtitle: {
text: 'The tooltip should provide a HTML table where the table is closed in the footerFormat'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
tooltip: {
shared: true,
useHTML: true,
pointFormat: '<button onclick="launchEvent()"></button>',
valueDecimals: 2
},
series: [{
name: 'Short',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}, {
name: 'Long named series',
data: [129.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 195.6, 154.4].reverse()
}]
});
The problem is that when I use the code below I get an error saying that launchEvent() doesn't exist in the page, which is not correct because it does exit. This led me to think that the method should be defined with a Highchart's method.
Any ideas, please? I want to have a click event inside the tooltip.