Updates the axes
object for display on the visualizer. This function is called after ChartPlot.update()
when the visualizer receives new data, and when scrubbing the time bar. The update()
method, therefore, should be used to store model data by time, which can then be used by draw()
.
Charts will refresh the entire canvas after updating each of the individual plots, so there is no need to refresh the canvas manually here unless it is desired to redraw the graph out of sync (e.g. if the subclass provides for interactivity and the plot should update while the model is paused).
Subclasses should call super().draw(t, forceUpdate)
at the end of the function.
Parameters
t — int, required
The model time whose data to draw. Because the
Charts
visualizer disables therefresh
parameter on runtime,Charts
will never pass a value oft
todraw()
that has not already been passed toupdate()
, where the data should be stored in the object.forceUpdate — bool, optional
Charts
refreshes all the plots at once each cycle. If interacting with a plot while the model is paused and it becomes necessary to update the display,forceUpdate
can be used to refresh the display before the next cycle. Note that the plot's data must be updated with theupdate()
method first.Default value: False
charwick
Feb 05, 2021 at 0:05An example of using
update()
anddraw()
to refresh the display while paused: