Reputation: 3461
I have a working chart (plotline) which displays activity for each month. What I am trying to do is to make each month on the plotline clickable to open another php script.
My chart:
$.getJSON("../charts/monthly_chart.php", function(json) {
$.each(json,function(i,el) {
if (el.name=="Month")
categories = el.data;
else
data2.push(el);
});
// other stuff
series: {
cursor: 'pointer',
point: {
events: {
click: function() {
window.top.location.href = "../month_rooms.php?month=<?php $GetMonth; ?>";
}
}
}
}
How do I get the name of the chart month into my click function: ../month_rooms.php?month=
Many thanks in advance for your help and time.
Cheers.
Upvotes: 1
Views: 80
Reputation: 3268
You are using the click-event of the point object. In that function the this
reference points to the current point that was clicked.
You can access every property of that point. The one you are looking for is the current category which is available under the same name.
For your redirection-example the code would need to look like this:
point: {
events: {
click: function() {
window.top.location.href = "../month_rooms.php?month=" + this.category;
}
}
}
Upvotes: 2