highchart alert x y axis
by Boyke Ferdinandes
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
JavaScript
var ser = []
ser = [
{name: 'Jan', y:29.9},
{name: 'Feb', y:71.5},
{name: 'Mar', y:106.4},
{name: 'Apr', y:129.2},
{name: 'May', y:144.0},
{name: 'Jun', y:176.0},
{name: 'Jul', y:135.6},
{name: 'Aug', y:148.5},
{name: 'Sep', y:216.4},
{name: 'Oct', y:194.1},
{name: 'Nov', y:95.6},
{name: 'Dec', y:54.4}
];
Highcharts.chart('container', {
xAxis: {
type: 'category',
//categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
alert('Category: ' + this.category + ' / ' + this.name + ', value: ' + this.y);
}
}
}
}
},
series: [{
data: ser
}]
});