Search in sources :

Example 1 with Level

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

the class Organization method createPlotOptions.

private PlotOptionsOrganization createPlotOptions() {
    PlotOptionsOrganization plotOptions = new PlotOptionsOrganization();
    plotOptions.setColorByPoint(false);
    plotOptions.setColor(new SolidColor("#007ad0"));
    DataLabels dataLabels = new DataLabels();
    dataLabels.setColor(SolidColor.BLACK);
    plotOptions.setDataLabels(dataLabels);
    plotOptions.setBorderColor(SolidColor.WHITE);
    Level level0 = new Level();
    level0.setLevel(0);
    level0.setColor(new SolidColor("#99AED3"));
    Level level1 = new Level();
    level1.setLevel(1);
    level1.setColor(new SolidColor("#CCE6C3"));
    Level level2 = new Level();
    level2.setLevel(2);
    level2.setColor(new SolidColor("#E1F39D"));
    Level level3 = new Level();
    level3.setLevel(3);
    level3.setColor(new SolidColor("#CCE6C3"));
    Level level4 = new Level();
    level4.setLevel(4);
    level4.setColor(new SolidColor("#CABEDC"));
    Level level5 = new Level();
    level5.setLevel(5);
    level5.setColor(new SolidColor("#CABDD4"));
    plotOptions.addLevel(level0);
    plotOptions.addLevel(level1);
    plotOptions.addLevel(level2);
    plotOptions.addLevel(level3);
    plotOptions.addLevel(level4);
    return plotOptions;
}
Also used : PlotOptionsOrganization(com.vaadin.flow.component.charts.model.PlotOptionsOrganization) DataLabels(com.vaadin.flow.component.charts.model.DataLabels) SolidColor(com.vaadin.flow.component.charts.model.style.SolidColor) Level(com.vaadin.flow.component.charts.model.Level)

Example 2 with Level

use of com.vaadin.flow.component.charts.model.Level 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

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