use of com.vaadin.flow.component.charts.model.HeatSeries in project flow-components by vaadin.
the class HeatMap method initDemo.
@Override
public void initDemo() {
Chart chart = new Chart();
Configuration config = chart.getConfiguration();
config.getChart().setType(ChartType.HEATMAP);
config.getChart().setMarginTop(40);
config.getChart().setMarginBottom(40);
config.getTitle().setText("Sales per employee per weekday");
config.getxAxis().setCategories("Marta", "Mysia", "Misiek", "Maniek", "Miki", "Guillermo", "Jonatan", "Zdzisław", "Antoni", "Zygmunt");
config.getyAxis().setCategories("Monday", "Tuesday", "Wednesday", "Thursday", "Friday");
config.getColorAxis().setMin(0);
config.getColorAxis().setMinColor(SolidColor.WHITE);
SolidColor lightBlue = new SolidColor(22, 118, 243);
config.getColorAxis().setMaxColor(lightBlue);
config.getLegend().setLayout(LayoutDirection.VERTICAL);
config.getLegend().setAlign(HorizontalAlign.RIGHT);
config.getLegend().setMargin(0);
config.getLegend().setVerticalAlign(VerticalAlign.TOP);
config.getLegend().setY(25);
config.getLegend().setSymbolHeight(320);
HeatSeries rs = new HeatSeries("Sales per employee", getRawData());
PlotOptionsHeatmap plotOptionsHeatmap = new PlotOptionsHeatmap();
plotOptionsHeatmap.setDataLabels(new DataLabels());
plotOptionsHeatmap.getDataLabels().setEnabled(true);
SeriesTooltip tooltip = new SeriesTooltip();
tooltip.setHeaderFormat("{series.name}<br/>");
tooltip.setPointFormat("Amount: <b>{point.value}</b> ");
plotOptionsHeatmap.setTooltip(tooltip);
config.setPlotOptions(plotOptionsHeatmap);
config.setSeries(rs);
add(chart);
}
Aggregations