Search in sources :

Example 86 with ListSeries

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

the class ChartBeforeClienResponseTest method beforeClientResponse_lineChartWithTimelineButFirstSeriesDoesNotSupportIt_throwException.

@Test(expected = RuntimeException.class)
public void beforeClientResponse_lineChartWithTimelineButFirstSeriesDoesNotSupportIt_throwException() throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
    TestChart chart = new TestChart(ChartType.LINE);
    chart.setTimeline(true);
    ListSeries series = new ListSeries();
    series.setPlotOptions(new TimelineNotSupportedPlotOptions(timelineNotSupported));
    chart.getConfiguration().addSeries(series);
    chart.beforeClientResponse(true);
}
Also used : ListSeries(com.vaadin.addon.charts.model.ListSeries) Test(org.junit.Test)

Example 87 with ListSeries

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

the class ChartBeforeClienResponseTest method beforeClientResponse_chartWithTimelineAndNoSupportForItButLineAsFirstSeries_chartIsSerialized.

@Test
public void beforeClientResponse_chartWithTimelineAndNoSupportForItButLineAsFirstSeries_chartIsSerialized() throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
    TestChart chart = new TestChart(timelineNotSupported);
    chart.setTimeline(true);
    ListSeries series = new ListSeries();
    series.setPlotOptions(new PlotOptionsLine());
    chart.getConfiguration().addSeries(series);
    chart.beforeClientResponse(true);
    assertNotNull(chart.getSerializedConfiguration());
    assertNotEquals("", chart.getSerializedConfiguration());
}
Also used : ListSeries(com.vaadin.addon.charts.model.ListSeries) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine) Test(org.junit.Test)

Example 88 with ListSeries

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

the class SerializationTest method serializeChart_configurationWithDrilldown_drilldownSeriesListSerializedCorrectly.

@Test
public void serializeChart_configurationWithDrilldown_drilldownSeriesListSerializedCorrectly() throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
    Chart input = new Chart();
    DataSeries dataSeries = new DataSeries();
    ListSeries drilldownSeries = new ListSeries();
    drilldownSeries.setId("id");
    dataSeries.addItemWithDrilldown(new DataSeriesItem("foobar", 42), drilldownSeries);
    input.getConfiguration().addSeries(dataSeries);
    Chart output = serializeObject(input);
    DataSeries outputSeries = (DataSeries) output.getConfiguration().getSeries().get(0);
    List<Series> outputDrilldownSeries = getPrivateField("drilldownSeries", outputSeries, DataSeries.class);
    assertNotNull("Drilldown series list was null after serialization", outputDrilldownSeries);
    assertThat("Drilldown series list was empty after serialization", outputDrilldownSeries, is(not(empty())));
}
Also used : Series(com.vaadin.addon.charts.model.Series) ListSeries(com.vaadin.addon.charts.model.ListSeries) DataSeries(com.vaadin.addon.charts.model.DataSeries) ListSeries(com.vaadin.addon.charts.model.ListSeries) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem) Test(org.junit.Test)

Aggregations

ListSeries (com.vaadin.addon.charts.model.ListSeries)88 Chart (com.vaadin.addon.charts.Chart)76 Configuration (com.vaadin.addon.charts.model.Configuration)70 YAxis (com.vaadin.addon.charts.model.YAxis)46 XAxis (com.vaadin.addon.charts.model.XAxis)35 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)31 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)25 Tooltip (com.vaadin.addon.charts.model.Tooltip)24 Legend (com.vaadin.addon.charts.model.Legend)18 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)18 DataLabels (com.vaadin.addon.charts.model.DataLabels)17 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)16 Title (com.vaadin.addon.charts.model.Title)15 Labels (com.vaadin.addon.charts.model.Labels)11 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)11 Marker (com.vaadin.addon.charts.model.Marker)10 VerticalLayout (com.vaadin.ui.VerticalLayout)9 Hover (com.vaadin.addon.charts.model.Hover)8 States (com.vaadin.addon.charts.model.States)8 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)8