JavaScript/jQuery Chart - Access a Series Using the API

The Chart exposes the following methods for accessing a series. All of them return one or several objects whose fields and methods are described in the Series section of the API reference.

  • getAllSeries()
    Gets all series of the Chart.

    JavaScript
    • var seriesCollection = $("#chartContainer").dxChart("getAllSeries");
  • getSeriesByName(seriesName)
    Gets a series by its name.

    JavaScript
    • var series = $("#chartContainer").dxChart("getSeriesByName", "Series 1");
  • getSeriesByPos(seriesIndex)
    Gets a series by its index in the series array. The index is zero-based.

    JavaScript
    • var series = $("#chartContainer").dxChart("getSeriesByPos", 0);

Apart from the API methods, you can access a series in the event handlers. For example, the onSeriesClick event handler gets the clicked series in the argument.

JavaScript
  • $(function() {
  • $("#chartContainer").dxChart({
  • // ...
  • onSeriesClick: function (e) {
  • var series = e.target;
  • // ...
  • }
  • });
  • });

Once you get the series, you can access its child points. For further information, refer to the Access a Series Point Using the API topic.

See Also