Interactive data updates
In Example: Tiles plot we have shown how to draw a (non-interactive) Mandelbrot set.
In this example, we show how to realize interactive visualizations with cost consuming calculations using the Mandelbrot set as an example. See also Example: Reacting to changes of axis limits for updating the plot according to the axis limits.
The code is almost the same as in Example: Tiles plot. The differences are
-
the event handler
updateLimits()
is called if the range of the axis is changed, and -
a request to (re)draw the graph using
requestAnimationFrame()
is made only when a previous redraw is finished.
Here a variable dataUpdateScheduled
works like an
exclusive lock.
The basic structure of the code is as follows: