Chart addChartSelectionListener issue

I am unable to get any events to occur with Chart’s addChartSelectionListener() method.

chart.addChartSelectionListener( new ChartSelectionListener() {
@Override
public void onSelection(ChartSelectionEvent event) {
// no event arrives
}
});

Questions:
a. Is there something special other than adding a Listener for an event to occur?

b. What activity must the user do with the chart for the event to occur?

c. Is addChartSelectionListener adding or setting the listener. The documentation implies that the addChartSelectionListener sets the listener rather than adds a listener, however the code underneath seems to being adding a Listener.

Thanks,
Malcolm

Hi.

a. To get the selection to function in chart you need to set the ZoomType chart.getConfiguration().getChart().setZoomType(ZoomType.X); b. In this instance the user just needs to ‘Click and drag in the plot area’ to zoom. As in:

http://demo.vaadin.com/charts/#TimeSeriesZoomable

c. Adding the chart selection listener overrides the default Highcharts action/zoom and you will need to handle this in the listener implementation.

Hope this helps.

  • Mikael

I am using vaadin 7.5.2 and I have upgraded vaadin charts from 2.0 to 2.1. I have written a class that implements ChartSelectionListener interface. I set the chart zoom type to ZoomType.X and I add this custom ChartSelectionListener to the chart and it works perfectly with vaadin charts 2.0. When the user makes a selection on the chart the onSelection method of the ChartSelectionListener fires. After upgrading to vaadin charts 2.1 the onSelection method of the listener no longer fires and the chart appears to revert to its default zoom behaviour (displaying the reset button and not running the custom code). Reverting to version 2.0 of vaadin-charts fixes the problem. Is there a bug in vaadin-charts 2.1 or is there some other line of code or setting that has to be used with version 2.1.