use of com.vaadin.addon.charts.model.PlotOptionsLine 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.PlotOptionsLine in project charts by vaadin.
the class ChartDataSeriesJSONSerializationTest method serialize_ContainerWithLinePlotOptions_PlotOptionsAndTypeSerialized.
@Test
public void serialize_ContainerWithLinePlotOptions_PlotOptionsAndTypeSerialized() {
PlotOptionsLine plotOptions = new PlotOptionsLine();
plotOptions.setShowInLegend(true);
final Pair<ListDataProvider<TestItem>, DataProviderSeries<TestItem>> pair = createTuple();
final DataProviderSeries<TestItem> dataProviderSeries = pair.getT2();
dataProviderSeries.setY(TestItem::getY);
dataProviderSeries.setPlotOptions(plotOptions);
Configuration config = new Configuration();
config.addSeries(dataProviderSeries);
String actual = toJSON(dataProviderSeries);
String expected = "{\"type\":\"line\",\"showInLegend\":true,\"data\":[]}";
assertEquals(expected, actual);
}
use of com.vaadin.addon.charts.model.PlotOptionsLine in project charts by vaadin.
the class ChartDesignReaderTest method readConfiguration_enableDataLabelsInPlotoptions_dataLabelsAreEnabledInConfiguration.
@Test
public void readConfiguration_enableDataLabelsInPlotoptions_dataLabelsAreEnabledInConfiguration() {
Elements elements = createElements("<plot-options><line><data-labels enabled=\"true\"></data-labels></line></plot-options>");
Configuration configuration = new Configuration();
ChartDesignReader.readConfigurationFromElements(elements, configuration);
PlotOptionsLine lineOptions = (PlotOptionsLine) configuration.getPlotOptions(ChartType.LINE);
assertEquals(true, lineOptions.getDataLabels().getEnabled());
}
Aggregations