Search in sources :

Example 56 with Chart

use of com.vaadin.addon.charts.Chart in project charts by vaadin.

the class ChartTypes method chartTypePolarSnippet1.

public void chartTypePolarSnippet1() {
    // Create a chart of some type
    Chart chart = new Chart(ChartType.LINE);
    // Enable the polar projection
    Configuration conf = chart.getConfiguration();
    conf.getChart().setPolar(true);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart)

Example 57 with Chart

use of com.vaadin.addon.charts.Chart in project charts by vaadin.

the class ChartTypes method chartTypesOhlcSnippet2.

public void chartTypesOhlcSnippet2() {
    Chart chart = new Chart(ChartType.OHLC);
    Configuration configuration = chart.getConfiguration();
    // Create a DataProvider filled with stock price data
    DataProvider<OhlcData, ?> dataProvider = initDataProvider();
    // Wrap the container in a data series
    DataProviderSeries<OhlcData> dataSeries = new DataProviderSeries<>(dataProvider);
    dataSeries.setX(OhlcData::getDate);
    dataSeries.setLow(OhlcData::getLow);
    dataSeries.setHigh(OhlcData::getHigh);
    dataSeries.setClose(OhlcData::getClose);
    dataSeries.setOpen(OhlcData::getOpen);
    PlotOptionsOhlc plotOptionsOhlc = new PlotOptionsOhlc();
    plotOptionsOhlc.setTurboThreshold(0);
    dataSeries.setPlotOptions(plotOptionsOhlc);
    configuration.setSeries(dataSeries);
}
Also used : DataProviderSeries(com.vaadin.addon.charts.model.DataProviderSeries) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsOhlc(com.vaadin.addon.charts.model.PlotOptionsOhlc) Chart(com.vaadin.addon.charts.Chart)

Example 58 with Chart

use of com.vaadin.addon.charts.Chart in project charts by vaadin.

the class ChartTypes method chartTypesWaterfallDataModel.

public void chartTypesWaterfallDataModel() {
    // Define the colors
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    // The data
    DataSeries series = new DataSeries();
    // The beginning balance
    DataSeriesItem start = new DataSeriesItem("Start", 306503);
    SolidColor balanceColor = SolidColor.KHAKI;
    start.setColor(balanceColor);
    series.add(start);
    // Deltas
    series.add(new DataSeriesItem("Predators", -3330));
    series.add(new DataSeriesItem("Slaughter", -103332));
    series.add(new DataSeriesItem("Reproduction", +104052));
    WaterFallSum end = new WaterFallSum("End");
    end.setColor(balanceColor);
    // Not intermediate (default)
    end.setIntermediate(false);
    series.add(end);
    conf.addSeries(series);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) DataSeries(com.vaadin.addon.charts.model.DataSeries) WaterFallSum(com.vaadin.addon.charts.model.WaterFallSum) Chart(com.vaadin.addon.charts.Chart) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem)

Example 59 with Chart

use of com.vaadin.addon.charts.Chart in project charts by vaadin.

the class ChartTypes method chartTypesSolidGaugeConfSnippet2.

public void chartTypesSolidGaugeConfSnippet2() {
    Chart chart = new Chart(ChartType.SOLIDGAUGE);
    Configuration conf = chart.getConfiguration();
    Pane pane = conf.getPane();
    Background bkg = new Background();
    // Gray
    bkg.setBackgroundColor(new SolidColor("#eeeeee"));
    // To make it an arc and not circle
    bkg.setInnerRadius("60%");
    // Default - not necessary
    bkg.setOuterRadius("100%");
    // solid or arc
    bkg.setShape("arc");
    pane.setBackground(bkg);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Background(com.vaadin.addon.charts.model.Background) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Pane(com.vaadin.addon.charts.model.Pane) Chart(com.vaadin.addon.charts.Chart)

Example 60 with Chart

use of com.vaadin.addon.charts.Chart in project charts by vaadin.

the class ChartTypes method chartTypesSolidGaugeSnippet1.

public void chartTypesSolidGaugeSnippet1() {
    Chart chart = new Chart(ChartType.SOLIDGAUGE);
    chart.setWidth("400px");
    chart.setHeight("400px");
}
Also used : Chart(com.vaadin.addon.charts.Chart)

Aggregations

Chart (com.vaadin.addon.charts.Chart)243 Configuration (com.vaadin.addon.charts.model.Configuration)196 YAxis (com.vaadin.addon.charts.model.YAxis)105 DataSeries (com.vaadin.addon.charts.model.DataSeries)81 ListSeries (com.vaadin.addon.charts.model.ListSeries)76 XAxis (com.vaadin.addon.charts.model.XAxis)71 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)57 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)55 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)50 DataLabels (com.vaadin.addon.charts.model.DataLabels)45 Tooltip (com.vaadin.addon.charts.model.Tooltip)44 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)34 Legend (com.vaadin.addon.charts.model.Legend)29 Marker (com.vaadin.addon.charts.model.Marker)23 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)21 Style (com.vaadin.addon.charts.model.style.Style)20 PlotOptionsPie (com.vaadin.addon.charts.model.PlotOptionsPie)19 Labels (com.vaadin.addon.charts.model.Labels)18 VerticalLayout (com.vaadin.ui.VerticalLayout)18 PlotOptionsSpline (com.vaadin.addon.charts.model.PlotOptionsSpline)16