use of com.vaadin.addon.charts.model.DataSeriesItem in project charts by vaadin.
the class ChartTypes method chartTypesScatterMarkerPropertiesSnippet1.
public void chartTypesScatterMarkerPropertiesSnippet1() {
double x = 1.0;
double y = 1.2;
double z = 1.45;
DataSeries series = new DataSeries();
DataSeriesItem point = new DataSeriesItem(x, y);
Marker marker = new Marker();
// Set line width and color
// Normally zero width
marker.setLineWidth(1);
marker.setLineColor(SolidColor.BLACK);
// Set RGB fill color
int level = (int) Math.round((1 - z) * 127);
marker.setFillColor(new SolidColor(255 - level, 0, level));
point.setMarker(marker);
marker.setRadius((z + 1) * 5);
series.add(point);
}
use of com.vaadin.addon.charts.model.DataSeriesItem in project charts by vaadin.
the class ChartData method asynchronousDrilldown.
public void asynchronousDrilldown(Chart chart) {
DataSeries series = new DataSeries();
DataSeriesItem mainItem = new DataSeriesItem("MSIE", 55.11);
series.addItemWithDrilldown(mainItem);
chart.setDrilldownCallback(new DrilldownCallback() {
@Override
public Series handleDrilldown(DrilldownEvent event) {
DataSeries drillDownSeries = new DataSeries("MSIE versions");
drillDownSeries.add(new DataSeriesItem("MSIE 6.0", 10.85));
drillDownSeries.add(new DataSeriesItem("MSIE 7.0", 7.35));
drillDownSeries.add(new DataSeriesItem("MSIE 8.0", 33.06));
drillDownSeries.add(new DataSeriesItem("MSIE 9.0", 2.81));
return drillDownSeries;
}
});
}
use of com.vaadin.addon.charts.model.DataSeriesItem 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));
}
use of com.vaadin.addon.charts.model.DataSeriesItem 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));
}
use of com.vaadin.addon.charts.model.DataSeriesItem 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));
}
Aggregations