use of com.vaadin.ui.VerticalLayout in project charts by vaadin.
the class ResizeInsideVaadinComponent method getChart.
@Override
protected Component getChart() {
VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel();
HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
horizontalSplitPanel.setSecondComponent(verticalSplitPanel);
verticalSplitPanel.setFirstComponent(createChart());
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setMargin(true);
verticalLayout.setSpacing(true);
verticalLayout.addComponent(new Label("Relatively sized components resize themselves automatically when in Vaadin component."));
Button button = new Button("Open in a window");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Window window = new Window("Chart windodw");
VerticalLayout layout = new VerticalLayout(createChart());
layout.setMargin(true);
layout.setSizeFull();
window.setContent(layout);
window.setWidth("50%");
window.setHeight("50%");
getUI().addWindow(window);
}
});
verticalLayout.addComponent(button);
horizontalSplitPanel.setFirstComponent(verticalLayout);
return horizontalSplitPanel;
}
use of com.vaadin.ui.VerticalLayout in project charts by vaadin.
the class TreeMapPointClick method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.TREEMAP);
chart.addPointClickListener(new PointClickListener() {
@Override
public void onClick(PointClickEvent event) {
lastAction.setValue(event.getClass().getSimpleName());
}
});
chart.getConfiguration().addSeries(createSeries());
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.addComponent(chart);
verticalLayout.addComponent(lastAction);
return verticalLayout;
}
use of com.vaadin.ui.VerticalLayout in project charts by vaadin.
the class BasicLineWithTickCount method getChart.
@Override
protected Component getChart() {
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(false);
layout.setMargin(false);
final Chart chart = new Chart(ChartType.LINE);
chart.setHeight("400px");
chart.setWidth("100%");
Configuration configuration = chart.getConfiguration();
configuration.getTitle().setText("Monthly Average Temperature");
configuration.getSubTitle().setText("Source: WorldClimate.com");
configuration.getxAxis().setCategories("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
XAxis xAxis = configuration.getxAxis();
Labels xLabels = new Labels();
xLabels.setAutoRotation(new Number[] { -10, -20, -30, -40, 50, -60, -70, -80, -90 });
xAxis.setLabels(xLabels);
final YAxis yAxis = configuration.getyAxis();
yAxis.setTickAmount(10);
ListSeries ls = new ListSeries();
ls.setName("Tokyo");
ls.setData(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6);
configuration.addSeries(ls);
ls = new ListSeries();
ls.setName("New York");
ls.setData(-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5);
configuration.addSeries(ls);
layout.addComponent(chart);
final Slider slider = new Slider("Tick count (2 - 16)", 2, 16);
slider.setWidth("200px");
slider.setValue(10d);
layout.addComponent(slider);
layout.addComponent(new Button("Set max amount", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
slider.setValue(16d);
}
}));
slider.addValueChangeListener(event -> {
double newValue = slider.getValue();
yAxis.setTickAmount(newValue);
chart.drawChart();
});
return layout;
}
use of com.vaadin.ui.VerticalLayout in project charts by vaadin.
the class ChartTypes method chartTypesSolidGaugeDataSnippet2.
public void chartTypesSolidGaugeDataSnippet2() {
VerticalLayout layout = new VerticalLayout();
final ListSeries series = new ListSeries("Pressure MPa", 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.ui.VerticalLayout 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);
}
Aggregations