Search in sources :

Example 76 with Chart

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

the class ChartTypes method chartTypesGaugeConfigurationSnippet1.

public void chartTypesGaugeConfigurationSnippet1() {
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Speedometer");
    conf.getPane().setStartAngle(-135);
    conf.getPane().setEndAngle(135);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart)

Example 77 with Chart

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

the class ChartTypes method chartTypesSolidGaugePlotoptionsSnippet1.

public void chartTypesSolidGaugePlotoptionsSnippet1() {
    Chart chart = new Chart(ChartType.SOLIDGAUGE);
    Configuration conf = chart.getConfiguration();
    PlotOptionsSolidgauge options = new PlotOptionsSolidgauge();
    // Move the value display box at the center a bit higher
    DataLabels dataLabels = new DataLabels();
    dataLabels.setY(-20);
    options.setDataLabels(dataLabels);
    conf.setPlotOptions(options);
}
Also used : DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsSolidgauge(com.vaadin.addon.charts.model.PlotOptionsSolidgauge) Chart(com.vaadin.addon.charts.Chart)

Example 78 with Chart

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

the class ChartTypes method chartTypesOhlcSnippet1.

public void chartTypesOhlcSnippet1() {
    Chart chart = new Chart(ChartType.OHLC);
    chart.setTimeline(true);
    Configuration configuration = chart.getConfiguration();
    configuration.getTitle().setText("AAPL Stock Price");
    DataSeries dataSeries = new DataSeries();
    Collection<OhlcData> dataBank = null;
    for (OhlcData data : dataBank) {
        OhlcItem item = new OhlcItem();
        item.setX(data.getDate());
        item.setLow(data.getLow());
        item.setHigh(data.getHigh());
        item.setClose(data.getClose());
        item.setOpen(data.getOpen());
        dataSeries.add(item);
    }
    configuration.setSeries(dataSeries);
    chart.drawChart(configuration);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) OhlcItem(com.vaadin.addon.charts.model.OhlcItem) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart)

Example 79 with Chart

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

the class ConfigurationTest method getPlotOptions_getAfterChartCreation_EmptyCollectionReturned.

@Test
public void getPlotOptions_getAfterChartCreation_EmptyCollectionReturned() {
    Chart chart = new Chart();
    Collection<AbstractPlotOptions> result = chart.getConfiguration().getPlotOptions();
    assertEquals(0, result.size());
}
Also used : AbstractPlotOptions(com.vaadin.addon.charts.model.AbstractPlotOptions) Chart(com.vaadin.addon.charts.Chart) Test(org.junit.Test)

Example 80 with Chart

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

the class ConfigurationTest method getPlotOptionsForType_noPlotOptionFound_ReturnNull.

@Test
public void getPlotOptionsForType_noPlotOptionFound_ReturnNull() {
    Chart chart = new Chart();
    AbstractPlotOptions result = chart.getConfiguration().getPlotOptions(ChartType.LINE);
    assertNull(result);
}
Also used : AbstractPlotOptions(com.vaadin.addon.charts.model.AbstractPlotOptions) Chart(com.vaadin.addon.charts.Chart) Test(org.junit.Test)

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