Mam highcharts, które renderuje dane zgodnie z danymi w mojej bazie danych. Używam typu "bar". Teraz chcę, aby użytkownicy klikali pasek przekierowujący do konkretnej strony lub np. Innej strony internetowej. Ja googlowałem, ale nie mogłem uzyskać odpowiedzi. Oto kod, którego używam.Jak hiperłącze wykres słupkowy w highcharts
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'bar'
},
title: {
text: 'Historic World Population by Region'
},
subtitle: {
text: 'Source: Wikipedia.org'
},
xAxis: {
categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: 'Population (millions)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
formatter: function() {
return ''+
this.series.name +': '+ this.y +' millions';
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -100,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: '#FFFFFF',
shadow: true
},
credits: {
enabled: false
},
series: [{
type: 'bar',
point: {
events: {
click: function(e) {
this.slice();
var clicked = this;
setTimeout(function(){
location.href = clicked.config[2];
}, 500)
e.preventDefault();
}
}
},
data: [['Com',107,'http://www.google.com']]
}]
});
});
});
Jaki jest błąd? –