use of com.vaadin.flow.component.html.OrderedList in project flow-components by vaadin.
the class ServerSideEvents method initDemo.
@Override
public void initDemo() {
historyLayout = new OrderedList();
historyLayout.setId("history");
chart = new Chart();
chart.setId("chart");
final Configuration configuration = chart.getConfiguration();
configuration.getChart().setWidth(500);
configuration.getChart().setType(ChartType.SCATTER);
configuration.getTitle().setText("Test server side events.");
configuration.getSubTitle().setText("When an event occurs, the details are shown below the chart");
configuration.setExporting(true);
configuration.getChart().setAnimation(false);
configuration.getChart().setZoomType(Dimension.XY);
configuration.getAccessibility().setEnabled(false);
XAxis xAxis = configuration.getxAxis();
xAxis.setMinPadding(0.2);
xAxis.setMaxPadding(0.2);
YAxis yAxis = configuration.getyAxis();
yAxis.setTitle(new AxisTitle("Value"));
PlotLine plotline = new PlotLine();
plotline.setValue(0);
plotline.setWidth(1);
plotline.setColor(new SolidColor("#808080"));
yAxis.setPlotLines(plotline);
yAxis.setMinPadding(0.2);
yAxis.setMaxPadding(0.2);
YAxis yAxis1 = new YAxis();
yAxis1.setTitle("Another axis");
yAxis1.setOpposite(true);
configuration.addyAxis(yAxis1);
PlotOptionsSeries opt = new PlotOptionsSeries();
opt.setShowCheckbox(true);
opt.setAllowPointSelect(true);
configuration.setPlotOptions(opt);
configuration.setTooltip(new Tooltip(false));
final DataSeries series1 = createDataSeries(0);
final DataSeries series2 = createDataSeries(20);
DataSeries series3 = createDataSeries(100);
series3.get(0).setY(105);
series3.get(3).setY(95);
series3.setName("Another axis");
series3.setyAxis(1);
DataSeriesItem firstDataPoint = series1.get(0);
firstDataPoint.setSelected(true);
configuration.setSeries(series1, series2, series3);
chart.addChartClickListener(this::logEvent);
chart.addPointClickListener(this::logEvent);
chart.addCheckBoxClickListener(this::logEvent);
chart.addSeriesLegendItemClickListener(this::logEvent);
chart.addSeriesHideListener(this::logEvent);
chart.addSeriesShowListener(this::logEvent);
chart.addPointSelectListener(this::logEvent);
chart.addPointUnselectListener(this::logEvent);
chart.addYAxesExtremesSetListener(this::logEvent);
chart.drawChart();
chart.setVisibilityTogglingDisabled(false);
VerticalLayout layout = new VerticalLayout();
layout.setId("master");
layout.add(createControls());
layout.add(new H2("Event History"), historyLayout);
add(chart, layout);
}
use of com.vaadin.flow.component.html.OrderedList in project flow-components by vaadin.
the class ColumnWithLazyMultiLevelDrilldownCallbackTests method initDemo.
@Override
public void initDemo() {
log = new OrderedList();
log.setId("log");
Div layout = new Div();
final Chart chart = new Chart(ChartType.COLUMN);
chart.setId("chart");
final Configuration conf = chart.getConfiguration();
PlotOptionsColumn column = new PlotOptionsColumn();
column.setCursor(Cursor.POINTER);
column.setAnimation(false);
conf.getDrilldown().setAnimation(false);
column.setDataLabels(new DataLabels(true));
conf.setPlotOptions(column);
DataSeries series = new DataSeries();
series.setName("Top");
createItems("Item").forEach(series::addItemWithDrilldown);
conf.addSeries(series);
chart.addChartDrillupListener(event -> log("ChartDrillupEvent"));
final NativeButton setNew = new NativeButton("set new callback", e -> chart.setDrilldownCallback(getDrilldownCallback()));
setNew.setId("setNew");
final NativeButton setSame = new NativeButton("set same callback", e -> chart.setDrilldownCallback(chart.getDrilldownCallback()));
setSame.setId("setSame");
final NativeButton setNull = new NativeButton("set null callback", e -> chart.setDrilldownCallback(null));
setNull.setId("setNull");
layout.add(chart, setNew, setSame, setNull, log);
add(layout);
}
Aggregations