Search in sources :

Example 1 with PlotOptionsTreemap

use of com.vaadin.flow.component.charts.model.PlotOptionsTreemap in project flow-components by vaadin.

the class TreemapWithColorAxis method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart(ChartType.TREEMAP);
    ColorAxis colorAxis = new ColorAxis();
    colorAxis.setMinColor(new SolidColor("#FFFFFF"));
    colorAxis.setMaxColor(new SolidColor("#7BB5EF"));
    chart.getConfiguration().addColorAxis(colorAxis);
    PlotOptionsTreemap plotOptions = new PlotOptionsTreemap();
    plotOptions.setLayoutAlgorithm(TreeMapLayoutAlgorithm.SQUARIFIED);
    TreeSeries series = createSeries();
    series.setPlotOptions(plotOptions);
    chart.getConfiguration().addSeries(series);
    chart.getConfiguration().setTitle("Vaadin Charts Treemap");
    add(chart);
}
Also used : TreeSeries(com.vaadin.flow.component.charts.model.TreeSeries) PlotOptionsTreemap(com.vaadin.flow.component.charts.model.PlotOptionsTreemap) ColorAxis(com.vaadin.flow.component.charts.model.ColorAxis) SolidColor(com.vaadin.flow.component.charts.model.style.SolidColor) Chart(com.vaadin.flow.component.charts.Chart)

Example 2 with PlotOptionsTreemap

use of com.vaadin.flow.component.charts.model.PlotOptionsTreemap 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);
}
Also used : TreeSeries(com.vaadin.flow.component.charts.model.TreeSeries) DataLabels(com.vaadin.flow.component.charts.model.DataLabels) Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsTreemap(com.vaadin.flow.component.charts.model.PlotOptionsTreemap) Level(com.vaadin.flow.component.charts.model.Level) Chart(com.vaadin.flow.component.charts.Chart)

Aggregations

Chart (com.vaadin.flow.component.charts.Chart)2 PlotOptionsTreemap (com.vaadin.flow.component.charts.model.PlotOptionsTreemap)2 TreeSeries (com.vaadin.flow.component.charts.model.TreeSeries)2 ColorAxis (com.vaadin.flow.component.charts.model.ColorAxis)1 Configuration (com.vaadin.flow.component.charts.model.Configuration)1 DataLabels (com.vaadin.flow.component.charts.model.DataLabels)1 Level (com.vaadin.flow.component.charts.model.Level)1 SolidColor (com.vaadin.flow.component.charts.model.style.SolidColor)1