use of com.vaadin.flow.component.charts.model.DataLabels in project flow-components by vaadin.
the class Treemap method initDemo.
@Override
public void initDemo() {
Chart chart = new Chart(ChartType.TREEMAP);
Configuration conf = chart.getConfiguration();
conf.getTooltip().setEnabled(true);
PlotOptionsTreemap plotOptions = new PlotOptionsTreemap();
plotOptions.setLayoutAlgorithm(TreeMapLayoutAlgorithm.STRIPES);
plotOptions.setAlternateStartingDirection(true);
Level level1 = new Level();
level1.setLevel(1);
level1.setLayoutAlgorithm(TreeMapLayoutAlgorithm.SLICEANDDICE);
DataLabels dataLabels = new DataLabels();
dataLabels.setEnabled(true);
dataLabels.setAlign(HorizontalAlign.LEFT);
dataLabels.setVerticalAlign(VerticalAlign.TOP);
level1.setDataLabels(dataLabels);
plotOptions.setLevels(level1);
TreeSeries series = createSeries();
series.setPlotOptions(plotOptions);
chart.getConfiguration().addSeries(series);
chart.getConfiguration().setTitle("Fruit consumption");
add(chart);
}
Aggregations