How do you implement the runWhileAttached method, like in this demo:
http://demo.vaadin.com/charts/#SplineUpdatingEachSecond?
runWhileAttached(chart, new Runnable() {
@Override
public void run() {
final long x = System.currentTimeMillis();
final double y = random.nextDouble();
series.add(new DataSeriesItem(x, y), true, true);
}
}, 1000, 1000);
Receive error: method runWhileAttached is undefined for type myApp.java
Here's the implementation for that: https://github.com/vaadin/charts/blob/7a55e8dab5b9941a05603c2624a576866e86045d/examples/src/main/java/com/vaadin/addon/charts/examples/AbstractVaadinChartExample.java#L29
It summary it puts polling with 1 second intervals, starts a new thread and while the UI still exists (=component is attached to UI), it runs the task and waits for one second.