Class myphysicslab.lab.graph.AutoScale

Provided By
All Implemented Interfaces

Watches the VarsList of one or more GraphLines to calculate the range rectangle that encloses the points on the graphs, and sets accordingly the simRect of a SimView. The range rectangle is the smallest rectangle that contains all the points, but possibly expanded by the #extraMargin factor.

Enabled and Active

To entirely disable an AutoScale, see #setEnabled. Assuming the AutoScale is enabled, it will react to events in the SimView and GraphLines as follows:

  • AutoScale becomes inactive when the SimView's simRect is changed by an entity other than this AutoScale. This happens when AutoScale observes a SimView event called LabView.SIM_RECT_CHANGED.

  • AutoScale becomes active when one of its GraphLines broadcasts a RESET event. This happens when a graph is cleared, or when the X or Y variable is changed.

You can also call #setActive directly to make an enabled AutoScale active or inactive.

Time Graph

For a time graph where one variable is time, the range rectangle in the time dimension has a fixed size specified by #setTimeWindow. The default time window is 10 seconds.

Events Broadcast

GenericEvent named #AUTO_SCALE is broadcast when the range rectangle changes.

Parameters Created

  • ParameterNumber named AutoScale.en.TIME_WINDOW see #setTimeWindow.

  • ParameterNumber named AutoScale.en.AXIS see #setAxis.

new AutoScale( name, graphLine, simView )


name of this AutoScale.


the GraphLine to observe in order to calculate the range rectangle of its points


the SimView whose simRect will be modified to the range rectangle

Instance Methods

Instance Properties

Static Properties

Type Definitions