use of com.vaadin.addon.charts.model.LegendNavigation in project charts by vaadin.
the class PieWithLegendNavigator method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.PIE);
Configuration conf = chart.getConfiguration();
Legend legend = conf.getLegend();
legend.setLayout(VERTICAL);
legend.setAlign(RIGHT);
legend.setVerticalAlign(TOP);
LegendNavigation nav = legend.getNavigation();
nav.setActiveColor(GREEN);
nav.setArrowSize(24);
conf.setTitle("Lot of slices to force navigation in legend");
PlotOptionsPie plotOptions = new PlotOptionsPie();
plotOptions.getDataLabels().setEnabled(false);
plotOptions.setShowInLegend(true);
conf.setPlotOptions(plotOptions);
DataSeries series = new DataSeries();
for (int i = 0; i < 50; i++) {
series.add(new DataSeriesItem("Item " + i, 1));
}
conf.addSeries(series);
return chart;
}
Aggregations