Search in sources :

Example 1 with SolidColor

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

use of com.vaadin.flow.component.charts.model.style.SolidColor 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 3 with SolidColor

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

the class ConfigurationJSONSerializationTest method configurationJSONSerialization_setOptionsWithInactiveState_inactiveStatesSerialized.

@Test
public void configurationJSONSerialization_setOptionsWithInactiveState_inactiveStatesSerialized() {
    Configuration conf = new Configuration();
    PlotOptionsPie options = new PlotOptionsPie();
    States states = options.getStates();
    Inactive inactive = states.getInactive();
    inactive.setOpacity(1.0);
    inactive.setBorderColor(new SolidColor("#000000"));
    inactive.setColor(new SolidColor("#808080"));
    inactive.setAnimation(false);
    conf.setPlotOptions(options);
    assertEquals("{\"chart\":{\"styledMode\":false},\"plotOptions\":{\"pie\":{\"states\":{\"inactive\":{\"animation\":false,\"borderColor\":\"#000000\",\"color\":\"#808080\",\"opacity\":1.0}}}},\"series\":[],\"exporting\":{\"enabled\":false}}", toJSON(conf));
}
Also used : States(com.vaadin.flow.component.charts.model.States) PlotOptionsPie(com.vaadin.flow.component.charts.model.PlotOptionsPie) Configuration(com.vaadin.flow.component.charts.model.Configuration) Inactive(com.vaadin.flow.component.charts.model.Inactive) SolidColor(com.vaadin.flow.component.charts.model.style.SolidColor) Test(org.junit.Test)

Example 4 with SolidColor

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

the class LumoDarkTheme method setAxisDefaults.

protected void setAxisDefaults(AxisStyle style) {
    style.setGridLineColor(GRID_COLOR);
    style.setLineColor(GRID_COLOR);
    style.setLineWidth(0);
    style.setTickWidth(0);
    style.setTickColor(new SolidColor(192, 208, 224));
    style.setAlternateGridColor(new SolidColor(255, 255, 255, 0.0));
    style.getTitle().setColor(TEXT_COLOR);
    style.getTitle().setFontWeight(FontWeight.BOLD);
    style.getSubtitle().setColor(SUBTITLE_COLOR);
    style.getSubtitle().setFontSize("14px");
    style.getSubtitle().setFontWeight(FontWeight.NORMAL);
    style.getLabels().setFontWeight(FontWeight.NORMAL);
    style.getLabels().setColor(LABEL_COLOR);
    style.getLabels().setFontSize("14px");
}
Also used : SolidColor(com.vaadin.flow.component.charts.model.style.SolidColor)

Example 5 with SolidColor

use of com.vaadin.flow.component.charts.model.style.SolidColor in project komunumo-server by komunumo.

the class AnalyticsBoard method populateCharts.

private void populateCharts(@NotNull final Year year) {
    // Top row widgets
    final var registrations = databaseService.countAttendeesByYear(year, NoShows.INCLUDE);
    final var events = databaseService.countEventsByYear(year);
    final var noShows = databaseService.countAttendeesByYear(year, NoShows.ONLY);
    numberOfRegistrations.setText(FormatterUtil.formatNumber(registrations));
    numberOfEvents.setText(FormatterUtil.formatNumber(events));
    noShowRate.setText(FormatterUtil.formatNumber(registrations == 0 ? 0 : noShows * 100L / registrations) + "%");
    final var locationColorMap = databaseService.getAllLocationColors();
    // First chart
    final var configuration = monthlyVisitors.getConfiguration();
    databaseService.calculateMonthlyVisitorsByYear(year).stream().map(data -> {
        final var series = new ListSeries(data.location(), data.january(), data.february(), data.march(), data.april(), data.may(), data.june(), data.july(), data.august(), data.september(), data.october(), data.november(), data.december());
        final var colorCode = locationColorMap.get(data.location());
        if (colorCode != null) {
            final var options = new PlotOptionsColumn();
            options.setColor(new SolidColor(colorCode));
            series.setPlotOptions(options);
        }
        return series;
    }).forEach(configuration::addSeries);
    final var x = new XAxis();
    x.setCrosshair(new Crosshair());
    x.setCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    configuration.addxAxis(x);
    final var y = new YAxis();
    y.setMin(0);
    y.setTitle("");
    configuration.addyAxis(y);
    final var tooltip = new Tooltip();
    tooltip.setShared(true);
    configuration.setTooltip(tooltip);
}
Also used : Serial(java.io.Serial) Board(com.vaadin.flow.component.board.Board) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) Tooltip(com.vaadin.flow.component.charts.model.Tooltip) Chart(com.vaadin.flow.component.charts.Chart) Component(com.vaadin.flow.component.Component) CssImport(com.vaadin.flow.component.dependency.CssImport) Crosshair(com.vaadin.flow.component.charts.model.Crosshair) NoShows(org.komunumo.data.entity.NoShows) XAxis(com.vaadin.flow.component.charts.model.XAxis) Div(com.vaadin.flow.component.html.Div) H2(com.vaadin.flow.component.html.H2) DatabaseService(org.komunumo.data.service.DatabaseService) ChartType(com.vaadin.flow.component.charts.model.ChartType) Year(java.time.Year) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) YAxis(com.vaadin.flow.component.charts.model.YAxis) NotNull(org.jetbrains.annotations.NotNull) Span(com.vaadin.flow.component.html.Span) SolidColor(com.vaadin.flow.component.charts.model.style.SolidColor) FormatterUtil(org.komunumo.util.FormatterUtil) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) Crosshair(com.vaadin.flow.component.charts.model.Crosshair) Tooltip(com.vaadin.flow.component.charts.model.Tooltip) SolidColor(com.vaadin.flow.component.charts.model.style.SolidColor) XAxis(com.vaadin.flow.component.charts.model.XAxis) YAxis(com.vaadin.flow.component.charts.model.YAxis)

Aggregations

SolidColor (com.vaadin.flow.component.charts.model.style.SolidColor)11 Chart (com.vaadin.flow.component.charts.Chart)5 Configuration (com.vaadin.flow.component.charts.model.Configuration)4 YAxis (com.vaadin.flow.component.charts.model.YAxis)3 DataLabels (com.vaadin.flow.component.charts.model.DataLabels)2 DataSeries (com.vaadin.flow.component.charts.model.DataSeries)2 PlotOptionsOrganization (com.vaadin.flow.component.charts.model.PlotOptionsOrganization)2 Tooltip (com.vaadin.flow.component.charts.model.Tooltip)2 XAxis (com.vaadin.flow.component.charts.model.XAxis)2 H2 (com.vaadin.flow.component.html.H2)2 Component (com.vaadin.flow.component.Component)1 Board (com.vaadin.flow.component.board.Board)1 AxisTitle (com.vaadin.flow.component.charts.model.AxisTitle)1 ChartType (com.vaadin.flow.component.charts.model.ChartType)1 ColorAxis (com.vaadin.flow.component.charts.model.ColorAxis)1 Crosshair (com.vaadin.flow.component.charts.model.Crosshair)1 DataSeriesItem (com.vaadin.flow.component.charts.model.DataSeriesItem)1 DataSeriesItemBullet (com.vaadin.flow.component.charts.model.DataSeriesItemBullet)1 HeatSeries (com.vaadin.flow.component.charts.model.HeatSeries)1 Inactive (com.vaadin.flow.component.charts.model.Inactive)1