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.

JavaScript
  • 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.

JavaScript
  • $(function() {
  • $("#pieChartContainer").dxPieChart({
  • // ...
  • onPointClick: function (e) {
  • var point = e.target;
  • // ...
  • }
  • });
  • });
NOTE
Each Point object contains a reference to its parent series in the series field.
See Also