1.5. Events
It is possible to configure handling of different event types for each chart type. The following listener types are available for all chart subtypes:
-
LegendItemHideListener
- hiding a legend item. -
LegendItemShowListener
- showing a legend item. -
LegendLabelClickListener
- click on a legend label. -
LegendMarkerClickListener
- click on a legend marker.
More event listeners for the exact chart subtype instance you can find in the corresponding sections of the manual.
Event handling examples are available in Using Events.
In order to migrate the old code that uses event listeners, the Chart
component should be cast to a concrete chart subtype or re-injected with a concrete subtype:
@Inject
private Chart pieChart;
((PieChart)pieChart).addSliceClickListener(event -> {});
Above the listeners, SeriesBasedChart
interface contains zoomOut
, zoomToIndexes
, and zoomToDates
methods for manipulating the chart axis.
The CoordinateChart
interface similarly provides the following methods for the value axis: zoomOutValueAxes
, zoomOutValueAxis
, zoomOutValueAxis
, zoomValueAxisToValues
, and zoomValueAxisToValues
.