Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
Restricting plotted points on a line chart
i want something like the sample provideed here https://demo.vaadin.com/charts/#SplineUpdatingEachSecond
How do i achieve something similair?
Chart chart = new Chart();
chart.setHeight("450px");
chart.setWidth("100%");
Configuration configuration = chart.getConfiguration();
configuration.getChart().setType(ChartType.LINE);
configuration.getChart().setMarginRight(130);
configuration.getChart().setMarginBottom(25);
configuration.getTitle().setText("Monitoring");
configuration.getxAxis().setType(AxisType.DATETIME);
DateTimeLabelFormats dateFmt = new DateTimeLabelFormats();
dateFmt.setSecond("%M:%S");
configuration.getxAxis().setDateTimeLabelFormats(dateFmt);
YAxis yAxis = configuration.getyAxis();
yAxis.setMin(0d);
yAxis.setTitle(new AxisTitle("Percentage"));
yAxis.getTitle().setAlign(VerticalAlign.MIDDLE);
PlotOptionsLine plotOptions = new PlotOptionsLine();
plotOptions.getDataLabels().setEnabled(true);
plotOptions.setThreshold(6);
configuration.setPlotOptions(plotOptions);
Legend legend = configuration.getLegend();
legend.setLayout(LayoutDirection.VERTICAL);
legend.setAlign(HorizontalAlign.CENTER);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setX(-10d);
legend.setY(100d);
legend.setBorderWidth(0);
chart.drawChart(configuration);
return chart;
setThreshold does not seem to be the right way to go
Last updated on
resolved it using shifting when adding an entry to a DataSeries
ls.add(new DataSeriesItem(time, percentage),true,true);
Last updated on
You cannot reply to this thread.