use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_plotLines_thePlotLinesAreTheElement.
@Test
public void writeConfiguration_plotLines_thePlotLinesAreTheElement() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
PlotLine plotLine = new PlotLine();
plotLine.setValue(0);
plotLine.setWidth(2);
configuration.getyAxis().setPlotLines(plotLine);
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<y-axis><plot-lines value=\"0\" width=\"2\"></plot-lines></y-axis>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_plotOptionsWithReservedPropertyWord_prefixIsWrittenToReservedProperty.
@Test
public void writeConfiguration_plotOptionsWithReservedPropertyWord_prefixIsWrittenToReservedProperty() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
PlotOptionsFlags plotOptionsFlags = new PlotOptionsFlags();
// plotOptionsFlags.setAllowPointSelect(true);
plotOptionsFlags.setOnSeries("dataseries");
configuration.addPlotOptions(plotOptionsFlags);
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<plot-options><flags draw-on-series=\"dataseries\"></flags></plot-options>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class ChartDesignReaderTest method readConfiguration_axisTitleHasTextOnlyContent_theContentIsSetAsTitleText.
@Test
public void readConfiguration_axisTitleHasTextOnlyContent_theContentIsSetAsTitleText() {
Elements elements = createElements("<y-axis><chart-title>my title</chart-title></y-axis>");
Configuration configuration = new Configuration();
ChartDesignReader.readConfigurationFromElements(elements, configuration);
assertEquals("my title", configuration.getyAxis().getTitle().getText());
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class ChartDesignReaderTest method readConfiguration_multiplePlotOptions_attributesAreReadToCorrectPlotOptions.
@Test
public void readConfiguration_multiplePlotOptions_attributesAreReadToCorrectPlotOptions() {
Elements elements = createElements("<plot-options>" + "<line animation=\"true\"></line>" + "<spline animation=\"false\"></spline>" + "</plot-options>");
Configuration configuration = new Configuration();
ChartDesignReader.readConfigurationFromElements(elements, configuration);
PlotOptionsLine line = (PlotOptionsLine) configuration.getPlotOptions(ChartType.LINE);
PlotOptionsSpline spline = (PlotOptionsSpline) configuration.getPlotOptions(ChartType.SPLINE);
assertFalse(spline.getAnimation());
assertTrue(line.getAnimation());
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class ChartDesignReaderTest method readConfiguration_multiplePlotOptions_plotOptionsLineIsAddedToConfiguration.
@Test
public void readConfiguration_multiplePlotOptions_plotOptionsLineIsAddedToConfiguration() {
Elements elements = createElements("<plot-options><line></line><spline></spline></plot-options>");
Configuration configuration = new Configuration();
ChartDesignReader.readConfigurationFromElements(elements, configuration);
assertEquals(2, configuration.getPlotOptions().size());
assertThat(configuration.getPlotOptions(ChartType.LINE), instanceOf(PlotOptionsLine.class));
assertThat(configuration.getPlotOptions(ChartType.SPLINE), instanceOf(PlotOptionsSpline.class));
}
Aggregations