Search in sources :

Example 26 with Configuration

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

the class ChartDesignWriterTest method writeConfiguration_axisPropertyIsSet_theValueIsAddedAsAttribute.

@Test
public void writeConfiguration_axisPropertyIsSet_theValueIsAddedAsAttribute() {
    DesignContext designContext = new DesignContext();
    Configuration configuration = new Configuration();
    configuration.getyAxis().setMin(-5);
    Element parent = new Element(Tag.valueOf("test"), "");
    ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
    assertEquals("<y-axis min=\"-5\"></y-axis>", parent.child(0).toString());
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Element(org.jsoup.nodes.Element) DesignContext(com.vaadin.ui.declarative.DesignContext) Test(org.junit.Test)

Example 27 with Configuration

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

the class ChartDesignWriterTest method writeConfiguration_emptyObject_nothingIsAddedToParentElement.

@Test
public void writeConfiguration_emptyObject_nothingIsAddedToParentElement() {
    DesignContext designContext = new DesignContext();
    Configuration configuration = new Configuration();
    Element parent = new Element(Tag.valueOf("test"), "");
    ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
    assertEquals("<test></test>", parent.toString());
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Element(org.jsoup.nodes.Element) DesignContext(com.vaadin.ui.declarative.DesignContext) Test(org.junit.Test)

Example 28 with Configuration

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

the class ChartDesignWriterTest method writeConfiguration_enableDataLabelsInPlotoptions_plotOptionsElementHasInnerTypeElement.

@Test
public void writeConfiguration_enableDataLabelsInPlotoptions_plotOptionsElementHasInnerTypeElement() {
    DesignContext designContext = new DesignContext();
    Configuration configuration = new Configuration();
    DataLabels dataLabels = new DataLabels(true);
    PlotOptionsLine plotOptionsLine = new PlotOptionsLine();
    plotOptionsLine.setDataLabels(dataLabels);
    configuration.setPlotOptions(plotOptionsLine);
    Element parent = new Element(Tag.valueOf("test"), "");
    ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
    assertEquals("<plot-options><line><data-labels enabled></data-labels></line></plot-options>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
Also used : DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine) Element(org.jsoup.nodes.Element) DesignContext(com.vaadin.ui.declarative.DesignContext) Test(org.junit.Test)

Example 29 with Configuration

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

the class ChartDesignWriterTest method writeConfiguration_arrayNode_theValuesInArrayAreSeparatedWithComma.

@Test
public void writeConfiguration_arrayNode_theValuesInArrayAreSeparatedWithComma() {
    DesignContext designContext = new DesignContext();
    Configuration configuration = new Configuration();
    configuration.getxAxis().setCategories("Jan", "Feb", "Mar");
    Element parent = new Element(Tag.valueOf("test"), "");
    ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
    assertEquals("<x-axis><categories>Jan, Feb, Mar</categories></x-axis>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Element(org.jsoup.nodes.Element) DesignContext(com.vaadin.ui.declarative.DesignContext) Test(org.junit.Test)

Example 30 with Configuration

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

the class ChartDesignWriterTest method writeConfiguration_numberValueDefinedInConfiguration_theValueIsAddedAsAttribute.

@Test
public void writeConfiguration_numberValueDefinedInConfiguration_theValueIsAddedAsAttribute() {
    DesignContext designContext = new DesignContext();
    Configuration configuration = new Configuration();
    Legend legend = new Legend();
    legend.setY(100);
    configuration.setLegend(legend);
    Element parent = new Element(Tag.valueOf("test"), "");
    ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
    assertEquals("<legend y=\"100\"></legend>", parent.child(0).toString());
}
Also used : Legend(com.vaadin.addon.charts.model.Legend) Configuration(com.vaadin.addon.charts.model.Configuration) Element(org.jsoup.nodes.Element) DesignContext(com.vaadin.ui.declarative.DesignContext) Test(org.junit.Test)

Aggregations

Configuration (com.vaadin.addon.charts.model.Configuration)257 Chart (com.vaadin.addon.charts.Chart)196 YAxis (com.vaadin.addon.charts.model.YAxis)100 DataSeries (com.vaadin.addon.charts.model.DataSeries)72 ListSeries (com.vaadin.addon.charts.model.ListSeries)70 XAxis (com.vaadin.addon.charts.model.XAxis)65 Test (org.junit.Test)58 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)56 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)54 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)51 Tooltip (com.vaadin.addon.charts.model.Tooltip)42 DataLabels (com.vaadin.addon.charts.model.DataLabels)41 Legend (com.vaadin.addon.charts.model.Legend)30 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)30 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)27 Elements (org.jsoup.select.Elements)27 Marker (com.vaadin.addon.charts.model.Marker)22 DesignContext (com.vaadin.ui.declarative.DesignContext)22 Element (org.jsoup.nodes.Element)22 PlotOptionsPie (com.vaadin.addon.charts.model.PlotOptionsPie)20