1.4. 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.

The following event listeners should be applied to the exact chart subtype instance:

AngularGaugeChart
  • ChartClickListener - click on the canvas.

  • ChartRightClickListener - right click on the canvas.

FunnelChart
  • SliceClickListener - click on a slice in a pie chart.

  • SlicePullInListener - shift of a slice of a pie chart into the chart.

  • SlicePullOutListener - shift of a slice of a pie chart out of the chart.

  • SliceRightClickListener - right-click on a slice in a pie chart.

GanttChart
  • AxisZoomListener - chart axis scaling.

  • CategoryItemClickListener - click on a category in the category axis.

  • ChartClickListener - click on the canvas.

  • ChartRightClickListener - right click on the canvas.

  • CursorPeriodSelectListener - selection of the display period with a cursor.

  • CursorZoomListener - scaling of the chart area with a cursor.

  • GraphClickListener - click on a graph.

  • GraphItemClickListener - click on a graph item.

  • GraphItemRightClickListener - right click on a graph item.

  • ZoomListener - scaling of the canvas.

PieChart
  • ChartClickListener - click on the canvas.

  • ChartRightClickListener - right click on the canvas.

  • SliceClickListener - click on a slice in a pie chart.

  • SlicePullInListener - shift of a slice of a pie chart into the chart.

  • SlicePullOutListener - shift of a slice of a pie chart out of the chart.

  • SliceRightClickListener - right-click on a slice in a pie chart.

RadarChart
  • AxisZoomListener - chart axis scaling.

  • ChartClickListener - click on the canvas.

  • ChartRightClickListener - right click on the canvas.

  • GraphClickListener - click on a graph.

  • GraphItemClickListener - click on a graph item.

  • GraphItemRightClickListener - right click on a graph item.

SerialChart
  • AxisZoomListener - chart axis scaling.

  • CategoryItemClickListener - click on a category in the category axis.

  • ChartClickListener - click on the canvas.

  • ChartRightClickListener - right click on the canvas.

  • CursorPeriodSelectListener - selection of the display period with a cursor.

  • CursorZoomListener - scaling of the chart area with a cursor.

  • GraphClickListener - click on a graph.

  • GraphItemClickListener - click on a graph item.

  • GraphItemRightClickListener - right click on a graph item.

  • ZoomListener - scaling of the canvas.

StockChartGroup
  • DataSetSelectorCompareListener - listener to dataset selector compare events.

  • DataSetSelectorSelectListener - selection of the dataset selector.

  • DataSetSelectorUnCompareListener - listener to the dataset selector uncompare events.

  • PeriodSelectorChangeListener - selection of the display period with a selector.

  • StockChartClickListener - click on the stock chart area.

  • StockChartRightClickListener - right click on the stock chart area.

  • StockEventClickListener - click on the stock event.

  • StockEventRollOutListener - stock event roll-out.

  • StockEventRollOverListener - stock event roll-over.

  • StockGraphClickListener - click on the stock graph.

  • StockGraphItemClickListener - click on the stock graph item.

  • StockGraphItemRightClickListener - right click on the stock graph item.

  • StockGraphItemRollOutListener - stock graph item roll-out events.

  • StockGraphItemRollOverListener - stock graph item roll-over events.

  • StockGraphRollOutListener - stock graph roll-out events.

  • StockGraphRollOverListener - stock graph roll-over events.

  • ZoomListener - scaling of the canvas.

  • ZoomListener - scaling of the canvas.

XYChart
  • AxisZoomListener - chart axis scaling.

  • ChartClickListener - click on the canvas.

  • CursorPeriodSelectListener - selection of the display period with a cursor.

  • CursorZoomListener - scaling of the chart area with a cursor.

  • GraphClickListener - click on a graph.

  • GraphItemClickListener - click on a graph item.

  • GraphItemRightClickListener - right click on a graph item.

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.