Search in sources :

Example 1 with Credits

use of com.vaadin.flow.component.charts.model.Credits in project flow-components by vaadin.

the class ColumnWithNegativeValues method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart(ChartType.COLUMN);
    Configuration conf = chart.getConfiguration();
    conf.setTitle(new Title("Column chart with negative values"));
    PlotOptionsColumn column = new PlotOptionsColumn();
    column.setMinPointLength(3);
    conf.setPlotOptions(column);
    XAxis xAxis = new XAxis();
    xAxis.setCategories("Apples", "Oranges", "Pears", "Grapes", "Bananas");
    conf.addxAxis(xAxis);
    Tooltip tooltip = new Tooltip();
    tooltip.setFormatter("function() { return ''+ this.series.name +': '+ this.y +'';}");
    conf.setTooltip(tooltip);
    conf.setCredits(new Credits(false));
    conf.addSeries(new ListSeries("John", 5, 0.1, 4, 7, 2));
    conf.addSeries(new ListSeries("Jane", 2, -2, -0.1, 2, 1));
    conf.addSeries(new ListSeries("Joe", 3, 4, 4, -2, 5));
    add(chart);
}
Also used : Credits(com.vaadin.flow.component.charts.model.Credits) Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) Tooltip(com.vaadin.flow.component.charts.model.Tooltip) Title(com.vaadin.flow.component.charts.model.Title) Chart(com.vaadin.flow.component.charts.Chart) XAxis(com.vaadin.flow.component.charts.model.XAxis)

Aggregations

Chart (com.vaadin.flow.component.charts.Chart)1 Configuration (com.vaadin.flow.component.charts.model.Configuration)1 Credits (com.vaadin.flow.component.charts.model.Credits)1 ListSeries (com.vaadin.flow.component.charts.model.ListSeries)1 PlotOptionsColumn (com.vaadin.flow.component.charts.model.PlotOptionsColumn)1 Title (com.vaadin.flow.component.charts.model.Title)1 Tooltip (com.vaadin.flow.component.charts.model.Tooltip)1 XAxis (com.vaadin.flow.component.charts.model.XAxis)1