JavaScript/jQuery PieChart - Access a Point Using the API
Before accessing a series point, gain access to its series by calling the getAllSeries() method. You can call the getSeriesByName(seriesName) or getSeriesByPos(seriesIndex) method as an alternative for multi-series PieCharts.
- var series = $("#pieChartContainer").dxPieChart("getAllSeries")[0];
Use the following methods to access series points. All of them return one or several objects whose fields and methods are described in the API reference's Point section.
getAllPoints()
Gets all the series points.JavaScript- var series = $("#pieChartContainer").dxPieChart("getAllSeries")[0];
- var seriesPoints = series.getAllPoints();
getPointsByArg(pointArg)
Gets those series points that have a specific argument.JavaScript- var chinaPoints = series.getPointsByArg("China");
getPointByPos(positionIndex)
Gets a point using its index. The index is zero-based.JavaScript- var firstPoint = series.getPointByPos(0);
getVisiblePoints()
Gets only visible series points.JavaScript- var visiblePoints = series.getVisiblePoints();
Apart from the API methods, you can access a series point in the event handlers. For example, the onPointClick event handler gets the clicked series point in the argument.
- $(function() {
- $("#pieChartContainer").dxPieChart({
- // ...
- onPointClick: function (e) {
- var point = e.target;
- // ...
- }
- });
- });
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.