bug4562 properly set selection state on legend clicking

This commit is contained in:
Kai Börnert committed 2018-05-17 16:00:39 +02:00
1 parent b813bf89fc
commit 15dd55ddc3
1 file changed
+11 -1
@@ -5,6 +5,8 @@ import org.moxieapps.gwt.highcharts.client.Legend;
import org.moxieapps.gwt.highcharts.client.Series;
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEventHandler;
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEventHandler;
import org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.SeriesPlotOptions;
@@ -27,7 +29,15 @@ public class ChartUtil {
series.setVisible(seriesCheckboxClickEvent.isChecked());
return false; // don't toggle the select state of the series
}
}));
}).setSeriesLegendItemClickEventHandler(new SeriesLegendItemClickEventHandler() {
@Override
public boolean onClick(SeriesLegendItemClickEvent seriesLegendItemClickEvent) {
Series series = chart.getSeries(seriesLegendItemClickEvent.getSeriesId());
series.setVisible(!series.isVisible());
series.select(series.isVisible());
return false;
}
}));
}
}