Reputation: 1
I have a Pie chart which is getting data from the database.What i want is when i click on slice of pie chart ,the chart should refresh and reload new data.Any help will appreciate??
thanks
Upvotes: 0
Views: 6736
Reputation: 3691
You can use the click event. Take a look at the API: http://api.highcharts.com/highcharts#series.data.events.click
From the event handler you can get the string with "this.name" or even get some kind of identifier with "this.options.somevariable"
"somevariable" means whatever variable name you create in the series data. For example in my case I name the identifier as simply "id":
{
name: "Slice 6",
id: 6,
events: {
click: function()
{
alert(
'The name is ' + this.name +
' and the identifier is ' + this.options.id
);
}
}
}
Upvotes: 1
Reputation: 108537
You do not really provide enough details but here is something to get you started. In this jsFiddle, I've set up an event to fire when you click on a pie slice. You could add an ajax method in this event to pull any new data from the server and redraw the chart (adjust the series and call the redraw method of the chart).
Please note, if you want a better answer you need to get more specific with your question. How are you building your charts? What have you tried so far that is/isn't working? Show some code, set up a jsFiddle as I have done, this will get you better results.
Upvotes: 1