Search in sources :

Example 76 with XAxis

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"));
}
Also used : DataProviderSeries(com.vaadin.addon.charts.model.DataProviderSeries) Configuration(com.vaadin.addon.charts.model.Configuration) AxisTitle(com.vaadin.addon.charts.model.AxisTitle) XAxis(com.vaadin.addon.charts.model.XAxis) YAxis(com.vaadin.addon.charts.model.YAxis) Test(org.junit.Test)

Example 77 with XAxis

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);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis)

Example 78 with 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));
}
Also used : AxisList(com.vaadin.addon.charts.model.AxisList) XAxis(com.vaadin.addon.charts.model.XAxis) Test(org.junit.Test)

Aggregations

XAxis (com.vaadin.addon.charts.model.XAxis)78 Chart (com.vaadin.addon.charts.Chart)71 Configuration (com.vaadin.addon.charts.model.Configuration)65 YAxis (com.vaadin.addon.charts.model.YAxis)63 Tooltip (com.vaadin.addon.charts.model.Tooltip)39 ListSeries (com.vaadin.addon.charts.model.ListSeries)35 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)26 DataSeries (com.vaadin.addon.charts.model.DataSeries)26 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)26 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)26 Legend (com.vaadin.addon.charts.model.Legend)20 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)17 DataLabels (com.vaadin.addon.charts.model.DataLabels)16 Title (com.vaadin.addon.charts.model.Title)16 Labels (com.vaadin.addon.charts.model.Labels)9 Style (com.vaadin.addon.charts.model.style.Style)9 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)8 PlotOptionsSpline (com.vaadin.addon.charts.model.PlotOptionsSpline)8 ArrayList (java.util.ArrayList)8 Marker (com.vaadin.addon.charts.model.Marker)7