score:29
Accepted answer
You want the event handling on the point config, not the series. Each wedge is a point in a single series:
var data = [{ name: 'One', y: 10, id: 0 },{ name: 'Two', y: 10, id: 1 }];
// some other code here...
series:[
{
"data": data,
type: 'pie',
animation: false,
point:{
events:{
click: function (event) {
alert(this.x + " " + this.y);
}
}
}
}
],
Fiddle here.
Full running code:
var chart;
point = null;
$(document).ready(function () {
var data = [{ name: 'One', y: 10, id: 0 },{ name: 'Two', y: 10, id: 1 }];
chart = new Highcharts.Chart(
{
series:[
{
"data": data,
type: 'pie',
animation: false,
point:{
events:{
click: function (event) {
alert(this.id);
}
}
}
}
],
"chart":{
"renderTo":"container"
},
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="width: 320px; height: 200px"></div>
Source: stackoverflow.com
Related Query
- Highcharts Pie charts get the selected pie id
- How to get the Div id of charts in highcharts on click of it in angular 6
- Why code of Horizonal line(y-axis) on a single in Highcharts get applied to all other charts integrated with Webdatarocks
- Highcharts - How can I get the name to display in the pie wedges?
- Highcharts Align pie charts to the Left
- Verify if Pie in Highcharts Pie charts is selected or deselected
- How to use Highcharts getSelectedPoints to get comma separated string of selected pie slices
- How to get highcharts dates in the x axis?
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- HighCharts - Make the pie chart 100% of the div
- Highcharts - Hidden charts don't get re-size properly
- How to hide labels in the highcharts in the pie
- How to get Highcharts X-Axis Categories starting at the left most point
- Highcharts Error #16: charts not showing on the same page
- How can I remove the white border from HighCharts pie chart?
- How do I get the value of a highcharts graph point on mouseover?
- Enable or disable data labels shown in pie charts in Highcharts on click of a button
- Tooltips getting cutoff in pie charts in highcharts
- How get data name in Highcharts pie chart legend instead of "Slice" using array of values?
- Highcharts pie charts can have url links
- Hiding label guidelines on Highcharts pie charts
- How do I style the series labels on a Highcharts pie chart?
- Get name of clicked point in Highcharts when the point has drilldown
- Highcharts (Highstock) how to manually set the navigator selected range
- Get x-axis label into the first colomn of the table - highcharts
- DotNet HighCharts , Populates a pie with the result of a query
- drilldown maps and funnell charts on the same page using highcharts
- Highcharts - Getting a 3d effect with selected pie chart slices
- Highcharts - Rotate pie chart aligning the clicked section to a fixed point (180°)
- Get the currently selected range from RangeSelector in Highstock
More Query from same tag
- TypeError: Cannot read properties of null (reading '0')
- How to zoom to specific point in Highmaps
- HIghcharts export server hosting ph-batik
- Highcharts export in IE malformed
- Javascript heatmap ReferenceError h337.create
- highcharts x-axis for 1 year displays tick/label of year +1
- Highcharts add button fix chart
- Building sparse array
- Scrollbar for y-axis is not showing in highcharts?
- How to apply borderRadius only for top side of Column or Bar in Highchart
- What is the highcharts-more file needed for?
- How to add clickable HTML-link into tooltip in Highcharts 5.0.x?
- R highcharter - grouped categories - missing label for group with one value only
- Adding same precision to the yAxis Label of HighCharts
- Change color of area chart programmatically in highcharts
- In Highcharts, how to avoid auto tick interval in a container with limited height
- Highcharts overlay multiple datetime series
- How can I prepare a Group Stacked Bar Chart in Highcharts using multiple and different types of data?
- Highcharts JS: Gap between X-Axis labels is too thin
- External legend in Highcharts
- How to use Highcharts.setOptions in react-highcharts?
- Highcharts bubble chart with updating default colors
- Hight chart show series data in milliseconds
- Highcharts polar chart wind rose data from JSON
- highcharts export server not working out of the box (Java)
- Highcharts: Context Menu Button, onclick function
- Legend height seems to have an impact on pie size
- Highcharts How to display total of data classes in legend
- How to load a highchart script within a WebPartZone
- Datalabels text overflow from plot area in highchart's pie chart