use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class ConfigurationTest method setSeries_containerDataSeriesWithName_NameAppearsInLegend.
@Test
public void setSeries_containerDataSeriesWithName_NameAppearsInLegend() {
Configuration conf = new Configuration();
conf.getChart().setType(ChartType.AREA);
XAxis xAxis = new XAxis();
xAxis.setCategories("A", "B", "C", "D", "E");
conf.addxAxis(xAxis);
YAxis yAxis = new YAxis();
AxisTitle title = new AxisTitle();
title.setText("Numbers");
yAxis.setTitle(title);
conf.addyAxis(yAxis);
DataProviderSeries<Pair> ds = new DataProviderSeries<>(createDataProvider());
ds.setName("Test Series1");
ds.setY(Pair::getValue);
ds.setPointName(Pair::getName);
// if a 'plotOptionsArea' is not set, the name of this series will not
// be shown in legend
// containerDataSeries1.setPlotOptions(new PlotOptionsArea());
conf.setSeries(ds);
Assert.assertTrue(toJSON(conf).contains("Test Series1"));
}
use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class BasicUse method basicUseAxisSnippet1.
public void basicUseAxisSnippet1() {
Chart chart = new Chart(ChartType.COLUMN);
Configuration conf = chart.getConfiguration();
XAxis xaxis = new XAxis();
xaxis.setCategories("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune");
xaxis.setTitle("Planet");
conf.addxAxis(xaxis);
}
use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class ConfigurationObjectJSONSerializationTest method toString_AxisListWithOneItem_SerializedAsSingleAxis.
@Test
public void toString_AxisListWithOneItem_SerializedAsSingleAxis() {
AxisList<XAxis> axisList = new AxisList<XAxis>();
axisList.addAxis(new XAxis());
ObjectContainer object = new ObjectContainer(axisList);
String axisJson = "{\"axisIndex\":0}";
assertEquals("{\"object\":" + axisJson + "}", toJSON(object));
}
Aggregations