Currently the way the internals work is that you need to set the SeriesPlotOptions directly on the Chart instance in order for the events to be wired up properly, as we don't yet support overriding the events on each Series instance separately. E.g. the following should work:
Chart chart = new Chart().setType(Series.Type.PIE);
Series s = chart.createSeries();
s.addPoint(new Point("label 1", 10));
s.addPoint(new Point("label 2", 20));
s.addPoint(new Point("label 3", 30));
SeriesPlotOptions options = new SeriesPlotOptions();
options.setAllowPointSelect(true);
options.setPointSelectEventHandler(new PointSelectEventHandler() {
public boolean onSelect(PointSelectEvent pointSelectEvent) {
Window.alert("select");
return true;
}
});
chart.setSeriesPlotOptions(options);
chart.addSeries(s);
Note that if you do need to distinguish which series the event was fired on though, you can retrieve the series from the event instance that is passed in (and you can access the original Series instance via the Chart.getSeries() method if needed). E.g.
final Chart chart = new Chart();
chart.setSeriesPlotOptions(new SeriesPlotOptions().setPointSelectEventHandler(new PointSelectEventHandler() {
public boolean onSelect(PointSelectEvent pointSelectEvent) {
Window.alert(pointSelectEvent.getSeriesName());
Series triggerSeries = chart.getSeries(pointSelectEvent.getSeriesId());
return true;
}
}));
Can you let us know if that resolves the issue you were seeing?
Last edit: Shawn Quinn 2011-09-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Currently the way the internals work is that you need to set the SeriesPlotOptions directly on the Chart instance in order for the events to be wired up properly, as we don't yet support overriding the events on each Series instance separately. E.g. the following should work:
Note that if you do need to distinguish which series the event was fired on though, you can retrieve the series from the event instance that is passed in (and you can access the original Series instance via the Chart.getSeries() method if needed). E.g.
Can you let us know if that resolves the issue you were seeing?
Last edit: Shawn Quinn 2011-09-01