Search in sources :

Example 36 with DataSeries

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

the class DataSeriesItemJSONSerializationTest method toJSON_xAndyAreSet_ItemSerializedWithXYAndNull.

@Test
public void toJSON_xAndyAreSet_ItemSerializedWithXYAndNull() {
    DataSeriesItem item = new DataSeriesItem();
    item.setX(2);
    item.setY(3);
    DataSeries series = new DataSeries();
    series.add(item);
    String expected = "{\"data\":[[2,3]]}";
    assertEquals(expected, toJSON(series));
}
Also used : DataSeries(com.vaadin.addon.charts.model.DataSeries) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem) Test(org.junit.Test)

Example 37 with DataSeries

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

the class DataSeriesItemJSONSerializationTest method toJSON_xIsSet_ItemSerializedWithXAndNulls.

@Test
public void toJSON_xIsSet_ItemSerializedWithXAndNulls() {
    DataSeriesItem item = new DataSeriesItem();
    item.setX(2);
    DataSeries series = new DataSeries();
    series.add(item);
    String expected = "{\"data\":[[2,null,null]]}";
    assertEquals(expected, toJSON(series));
}
Also used : DataSeries(com.vaadin.addon.charts.model.DataSeries) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem) Test(org.junit.Test)

Example 38 with DataSeries

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

the class DataSeriesItemJSONSerializationTest method toJSON_yIsSet_ItemSerializedWithY.

@Test
public void toJSON_yIsSet_ItemSerializedWithY() {
    DataSeriesItem item = new DataSeriesItem();
    item.setY(2);
    DataSeries series = new DataSeries();
    series.add(item);
    String expected = "{\"data\":[2]}";
    assertEquals(expected, toJSON(series));
}
Also used : DataSeries(com.vaadin.addon.charts.model.DataSeries) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem) Test(org.junit.Test)

Example 39 with DataSeries

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

the class DataSeriesItemJSONSerializationTest method toJSON_PlotOptionsPyramidIsSet_SeriesSerializedWithType.

@Test
public void toJSON_PlotOptionsPyramidIsSet_SeriesSerializedWithType() {
    DataSeries series = new DataSeries();
    series.setPlotOptions(new PlotOptionsPyramid());
    String expected = "{\"data\":[],\"type\":\"pyramid\"}";
    assertEquals(expected, toJSON(series));
}
Also used : PlotOptionsPyramid(com.vaadin.addon.charts.model.PlotOptionsPyramid) DataSeries(com.vaadin.addon.charts.model.DataSeries) Test(org.junit.Test)

Example 40 with DataSeries

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

the class DataSeriesItemJSONSerializationTest method toJSON_lowAndHighSet_ItemSerializedAsArrayWithLowAndHigh.

@Test
public void toJSON_lowAndHighSet_ItemSerializedAsArrayWithLowAndHigh() {
    DataSeriesItem item = new DataSeriesItem();
    item.setLow(2);
    item.setHigh(3);
    DataSeries series = new DataSeries();
    series.add(item);
    String expected = "{\"data\":[[2,3]]}";
    assertEquals(expected, toJSON(series));
}
Also used : DataSeries(com.vaadin.addon.charts.model.DataSeries) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem) Test(org.junit.Test)

Aggregations

DataSeries (com.vaadin.addon.charts.model.DataSeries)118 Chart (com.vaadin.addon.charts.Chart)81 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)81 Configuration (com.vaadin.addon.charts.model.Configuration)71 YAxis (com.vaadin.addon.charts.model.YAxis)38 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)26 XAxis (com.vaadin.addon.charts.model.XAxis)25 DataLabels (com.vaadin.addon.charts.model.DataLabels)21 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)17 Tooltip (com.vaadin.addon.charts.model.Tooltip)15 Test (org.junit.Test)15 PlotOptionsPie (com.vaadin.addon.charts.model.PlotOptionsPie)14 PlotOptionsSpline (com.vaadin.addon.charts.model.PlotOptionsSpline)14 Marker (com.vaadin.addon.charts.model.Marker)13 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)13 Style (com.vaadin.addon.charts.model.style.Style)10 Random (java.util.Random)10 Legend (com.vaadin.addon.charts.model.Legend)9 PlotLine (com.vaadin.addon.charts.model.PlotLine)9 StockPrices (com.vaadin.addon.charts.examples.timeline.util.StockPrices)8