Clickable HighCharts -
Clickable Highcharts bar Chart - recognizes the column name when clicked
by Andrew Pougher
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
JavaScript
$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function() {
// location.href = this.options.url;
alert(this.category)
}
}
}
}
},
series: [{
data: [{
y: 29.9,
url: 'http://yoururl.com/monthdata?m=' + this.category
}, {
y: 71.5,
url: 'http://yoururl.com/monthdata?m=' + this.category
}, {
y: 106.4,
url: 'http://yoururl.com/monthdata?m=' + this.category
}]
}]
});
});