This module can be configured using Manager. For instructions, see Map Widgets.
The Scale Bar Module implements the Scale Bar map widget and Scale Input map widget.
Dual-unit line scale bar (left) and metric ruler scale bar (right)
Scale Input Box
The Scale Input map widget allows users to enter a new scale to zoom the map to. This feature always represents scale as a ratio, for example, 1:1128, 1:300890, or 1:11024035. The Scale Input map widget is enabled by default.
Scale Input map widget, collapsed
The user clicks the map widget to expand it.
Scale Input map widget, expanded
If the map includes a tiled basemap, the user can use the drop-down menu to pick from a preset list of scales. To zoom to the new scale value, the user presses Enter or clicks Go.
Drop-down list of preset scales
If the map uses a tiled basemap and the user enters a scale that is between available scales, the viewer automatically adjusts the user input to the nearest available scale.
In Chrome for desktop, use the up or down arrow to adjust the scale by increments of one.
Module
No configuration
properties
Views
ScaleInputBoxButtonView
: To hide the Scale Input map widget toggle button, set this view's visible
property to false
.
ScaleInputBoxView
: To allow the openByDefault
property to work properly, leave this view's visible
property set to true
.
ScalebarView
: To show the scale bar, set the view's visible
property to true
. The default value is false
.
scalebarStyle
: The style of the scale bar. The possible values are: ruler
or line
. The default is ruler
.
scalebarUnit
: The type of units of the scale bar. The possible values are: metric
, english
(US customary units), or dual
(both metric and US customary units). The default is metric
.
The dual
option can only be used with the line
scale bar style.
showBackground
: To display a background for the scale bar, set to true
. The default is true
.
View Models
ScalebarViewModel
:
scaleInputBox
: Configure the Scale Input map widget and its visibility.
isEnabled
: Enables the Scale Input map widget. The default value is false
.
openByDefault
: Sets whether the Scale Input map widget is expanded by default. The default value is true
.
If the isEnabled
property is set to false
, the openByDefault
property is ignored and the Scale Input map widget does not appear.
If the ScaleInputBoxView
's visible
property is set to false
, the openByDefault
property is ignored and the Scale Input map widget does not expand by default.