getSelectedItemsIndexes();
The getSelectedItemsIndexes method returns indexes of selected legend elements.
To execute the example, create html page displaying histogram with legend. Histogram settings are specified using the Chart component.
Select legend elements and execute the following operations in console:
//Get interval legend var legend = chart.getLegend(); //Get indexes of selected legend elements var items = legend.getSelectedItemsIndexes(); //Display indexes to console console.log(items);
After executing the example, the console displays indexes of selected legend elements:
(2) [0, 1]
See also: