Search in sources :

Example 76 with Configuration

use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.

the class ChartTypes method chartTypesWaterfallPlotoptions.

public void chartTypesWaterfallPlotoptions() {
    // Define the colors
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    final Color balanceColor = SolidColor.BLACK;
    final Color positiveColor = SolidColor.BLUE;
    final Color negativeColor = SolidColor.RED;
    // Configure the colors
    PlotOptionsWaterfall options = new PlotOptionsWaterfall();
    options.setUpColor(positiveColor);
    options.setColor(negativeColor);
    // Configure the labels
    DataLabels labels = new DataLabels(true);
    labels.setVerticalAlign(VerticalAlign.TOP);
    labels.setY(-20);
    labels.setFormatter("Math.floor(this.y/1000) + 'k'");
    Style style = new Style();
    style.setColor(SolidColor.BLACK);
    style.setFontWeight(FontWeight.BOLD);
    labels.setStyle(style);
    options.setDataLabels(labels);
    options.setPointPadding(0);
    conf.setPlotOptions(options);
}
Also used : DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Color(com.vaadin.addon.charts.model.style.Color) GradientColor(com.vaadin.addon.charts.model.style.GradientColor) PlotOptionsWaterfall(com.vaadin.addon.charts.model.PlotOptionsWaterfall) DashStyle(com.vaadin.addon.charts.model.DashStyle) Style(com.vaadin.addon.charts.model.style.Style) Chart(com.vaadin.addon.charts.Chart)

Example 77 with Configuration

use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.

the class ChartTypes method chartTypesPieSnippet1.

public void chartTypesPieSnippet1() {
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    PlotOptionsPie options = new PlotOptionsPie();
    // Non-0 results in a donut
    options.setInnerSize("0");
    // Default
    options.setSize("75%");
    // Default
    options.setCenter("50%", "50%");
    conf.setPlotOptions(options);
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart)

Example 78 with Configuration

use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.

the class ChartTypes method chartTypesBoxplotSnippet1.

public void chartTypesBoxplotSnippet1() {
    Chart chart = new Chart(ChartType.BOXPLOT);
    chart.setWidth("400px");
    chart.setHeight("300px");
    // Modify the default configuration a bit
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Orienteering Split Times");
    conf.getLegend().setEnabled(false);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart)

Example 79 with Configuration

use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.

the class GettingStarted method configuringTheColors.

public void configuringTheColors() {
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    DataSeries girls = new DataSeries("Girls");
    DataSeries boys = new DataSeries("Boys");
    PlotOptionsLine girlsOpts = new PlotOptionsLine();
    girlsOpts.setColor(SolidColor.HOTPINK);
    girls.setPlotOptions(girlsOpts);
    PlotOptionsLine boysOpts = new PlotOptionsLine();
    boysOpts.setColor(SolidColor.BLUE);
    boys.setPlotOptions(boysOpts);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart)

Example 80 with Configuration

use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.

the class GettingStarted method addColumnsSnippet1.

public void addColumnsSnippet1(List<WeatherInfo> weatherInfo) {
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    ListDataProvider<WeatherInfo> dataProvider = new ListDataProvider<>(weatherInfo);
    DataProviderSeries<WeatherInfo> humidity = new DataProviderSeries<>(dataProvider);
    humidity.setName("Humidity");
    humidity.setX(WeatherInfo::getInstant);
    humidity.setY(WeatherInfo::getMeanHumidity);
    humidity.setPlotOptions(new PlotOptionsColumn());
    conf.addSeries(humidity);
}
Also used : ListDataProvider(com.vaadin.data.provider.ListDataProvider) DataProviderSeries(com.vaadin.addon.charts.model.DataProviderSeries) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsColumn(com.vaadin.addon.charts.model.PlotOptionsColumn) Chart(com.vaadin.addon.charts.Chart)

Aggregations

Configuration (com.vaadin.addon.charts.model.Configuration)257 Chart (com.vaadin.addon.charts.Chart)196 YAxis (com.vaadin.addon.charts.model.YAxis)100 DataSeries (com.vaadin.addon.charts.model.DataSeries)72 ListSeries (com.vaadin.addon.charts.model.ListSeries)70 XAxis (com.vaadin.addon.charts.model.XAxis)65 Test (org.junit.Test)58 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)56 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)54 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)51 Tooltip (com.vaadin.addon.charts.model.Tooltip)42 DataLabels (com.vaadin.addon.charts.model.DataLabels)41 Legend (com.vaadin.addon.charts.model.Legend)30 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)30 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)27 Elements (org.jsoup.select.Elements)27 Marker (com.vaadin.addon.charts.model.Marker)22 DesignContext (com.vaadin.ui.declarative.DesignContext)22 Element (org.jsoup.nodes.Element)22 PlotOptionsPie (com.vaadin.addon.charts.model.PlotOptionsPie)20