Я хотел настроить событие щелчка, чтобы получить значения xAxis на моем графике.В моем случае у меня есть две оси x, и я хотел получить их обе.В настоящее время в моем примере я могу получить только самое верхнее значение xAxis, как я могу получить оба значения, когда я делаю событие клика на моем графике?
js fiddle link
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px; width: 900px"></div>
Highcharts.chart('container', {
chart: {
type: 'column'
},
xAxis: [{
categories: ['Catagory 1', 'Catagory 2', 'Catagory '],
labels: {
style:{
color: 'red'
},
formatter: function () {
return this.value;
}
}
},
{
linkedTo: 0,
categories: ['Dec 4', 'Dec 5', 'Dec 6'],
}],
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function() {
var tableDate = this.category;
console.log(this);
alert(tableDate);
/* window.location.href = '/performance_reports_detail'; */
}
}
}
}
},
series: [{
name: 'Group Value 1',
data: [29.9, 71.5, 106.4]
},
{
name: 'Group Value 2',
data: [50, 71.5, 106.4]
},
{
name: 'Group Value 3',
data: [21, 71.5, 106.4]
}]
});
![chart pic](https://i.stack.imgur.com/h1MdT.png)
![object](https://i.stack.imgur.com/PEn2p.png)