Search in sources :

Example 16 with DataLabels

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);
}
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)16 Chart (com.vaadin.flow.component.charts.Chart)15 Configuration (com.vaadin.flow.component.charts.model.Configuration)12 YAxis (com.vaadin.flow.component.charts.model.YAxis)10 DataSeries (com.vaadin.flow.component.charts.model.DataSeries)9 DataSeriesItem (com.vaadin.flow.component.charts.model.DataSeriesItem)6 PlotOptionsColumn (com.vaadin.flow.component.charts.model.PlotOptionsColumn)6 XAxis (com.vaadin.flow.component.charts.model.XAxis)6 Tooltip (com.vaadin.flow.component.charts.model.Tooltip)4 AxisTitle (com.vaadin.flow.component.charts.model.AxisTitle)3 ListSeries (com.vaadin.flow.component.charts.model.ListSeries)3 Level (com.vaadin.flow.component.charts.model.Level)2 PlotOptionsLine (com.vaadin.flow.component.charts.model.PlotOptionsLine)2 SeriesTooltip (com.vaadin.flow.component.charts.model.SeriesTooltip)2 SolidColor (com.vaadin.flow.component.charts.model.style.SolidColor)2 Div (com.vaadin.flow.component.html.Div)2 NativeButton (com.vaadin.flow.component.html.NativeButton)2 Text (com.vaadin.flow.component.Text)1 AbstractChartExample (com.vaadin.flow.component.charts.examples.AbstractChartExample)1 AxisType (com.vaadin.flow.component.charts.model.AxisType)1