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);
}
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);
}
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);
}
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);
}
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);
}
}
Aggregations