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);
}
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());
}
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())));
}
Aggregations