Search in sources :

Example 81 with ListSeries

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

the class ChartTypes method chartTypesGaugeDataSnippet2.

public void chartTypesGaugeDataSnippet2() {
    VerticalLayout layout = new VerticalLayout();
    final ListSeries series = new ListSeries("Speed", 80);
    final TextField tf = new TextField("Enter a new value");
    layout.addComponent(tf);
    Button update = new Button("Update", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Integer newValue = new Integer(tf.getValue());
            series.updatePoint(0, newValue);
            ;
        }
    });
    layout.addComponent(update);
}
Also used : ListSeries(com.vaadin.addon.charts.model.ListSeries) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField)

Example 82 with ListSeries

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

the class ConfigurationTest method setup.

@Before
public void setup() {
    ListSeries row1 = new ListSeries("row1", 1, 2);
    ListSeries row2 = new ListSeries("row2", 4, 5);
    ListSeries row3 = new ListSeries("row3", 7, 8);
    ListSeries row4 = new ListSeries("row4", 10, 11);
    String[] cols = { "col1", "col2" };
    Chart chart = new Chart(ChartType.COLUMN);
    conf = chart.getConfiguration();
    XAxis axis = new XAxis();
    axis.setCategories(cols);
    conf.addxAxis(axis);
    conf.setSeries(row1, row2, row3, row4);
}
Also used : ListSeries(com.vaadin.addon.charts.model.ListSeries) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) Before(org.junit.Before)

Example 83 with ListSeries

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

the class ChartTypes method chartTypesErrorbarSnippet1.

public void chartTypesErrorbarSnippet1() {
    // Create a chart of some primary type
    Chart chart = new Chart(ChartType.SCATTER);
    chart.setWidth("600px");
    chart.setHeight("400px");
    // Modify the default configuration a bit
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Average Temperatures in Turku");
    conf.getLegend().setEnabled(false);
    // The primary data series
    ListSeries averages = new ListSeries(-6, -6.5, -4, 3, 9, 14, 17, 16, 11, 6, 2, -2.5);
    // Error bar data series with low and high values
    DataSeries errors = new DataSeries();
    errors.add(new DataSeriesItem(0, -9, -3));
    errors.add(new DataSeriesItem(1, -10, -3));
    errors.add(new DataSeriesItem(2, -8, 1));
    // Configure the stem and whiskers in error bars
    PlotOptionsErrorbar barOptions = new PlotOptionsErrorbar();
    barOptions.setStemColor(SolidColor.GREY);
    barOptions.setStemWidth(2);
    barOptions.setStemDashStyle(DashStyle.DASH);
    barOptions.setWhiskerColor(SolidColor.BROWN);
    // 80% of category width
    barOptions.setWhiskerLength(80, Sizeable.Unit.PERCENTAGE);
    // Pixels
    barOptions.setWhiskerWidth(2);
    errors.setPlotOptions(barOptions);
    // The errors should be drawn lower
    conf.addSeries(errors);
    conf.addSeries(averages);
}
Also used : PlotOptionsErrorbar(com.vaadin.addon.charts.model.PlotOptionsErrorbar) Configuration(com.vaadin.addon.charts.model.Configuration) ListSeries(com.vaadin.addon.charts.model.ListSeries) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem)

Example 84 with ListSeries

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

the class ChartData method listSeriesSnippet1.

public void listSeriesSnippet1(Configuration conf) {
    ListSeries series = new ListSeries("Total Reindeer Population", 181091, 201485, 188105);
    PlotOptionsLine plotOptions = new PlotOptionsLine();
    plotOptions.setPointStart(1959);
    series.setPlotOptions(plotOptions);
    conf.addSeries(series);
}
Also used : ListSeries(com.vaadin.addon.charts.model.ListSeries) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine)

Example 85 with ListSeries

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

the class BasicUse method basicUseTwoDimensional.

public void basicUseTwoDimensional() {
    Chart chart = new Chart(ChartType.COLUMN);
    Configuration conf = chart.getConfiguration();
    String[] predators = { "Bear", "Wolf", "Wolverine", "Lynx" };
    int[][] kills = { // Muddusjarvi
    { 8, 0, 7, 0 }, // Ivalo
    { 30, 1, 30, 2 }, // Oraniemi
    { 37, 0, 22, 2 }, // Salla
    { 13, 23, 4, 1 }, // Alakitka
    { 3, 10, 9, 0 } };
    // Create a data series for each numeric column in the table
    for (int predator = 0; predator < 4; predator++) {
        ListSeries series = new ListSeries();
        series.setName(predators[predator]);
        // The rows of the table
        for (int location = 0; location < kills.length; location++) series.addData(kills[location][predator]);
        conf.addSeries(series);
    }
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) ListSeries(com.vaadin.addon.charts.model.ListSeries) Chart(com.vaadin.addon.charts.Chart)

Aggregations

ListSeries (com.vaadin.addon.charts.model.ListSeries)88 Chart (com.vaadin.addon.charts.Chart)76 Configuration (com.vaadin.addon.charts.model.Configuration)70 YAxis (com.vaadin.addon.charts.model.YAxis)46 XAxis (com.vaadin.addon.charts.model.XAxis)35 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)31 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)25 Tooltip (com.vaadin.addon.charts.model.Tooltip)24 Legend (com.vaadin.addon.charts.model.Legend)18 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)18 DataLabels (com.vaadin.addon.charts.model.DataLabels)17 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)16 Title (com.vaadin.addon.charts.model.Title)15 Labels (com.vaadin.addon.charts.model.Labels)11 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)11 Marker (com.vaadin.addon.charts.model.Marker)10 VerticalLayout (com.vaadin.ui.VerticalLayout)9 Hover (com.vaadin.addon.charts.model.Hover)8 States (com.vaadin.addon.charts.model.States)8 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)8