Skip to content
import ScaleBarViewModel from "@arcgis/core/widgets/ScaleBar/ScaleBarViewModel.js";
Inheritance:
ScaleBarViewModelAccessor
Since
ArcGIS Maps SDK for JavaScript 4.3

Provides the logic for the Scale Bar component and ScaleBar widget.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
declaredClass
readonly inherited
state
readonly

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

state

readonly Property
Type
ScaleBarViewModelState

The current state of the widget.

view

Property
Type
MapView | null | undefined

The view from which the widget will operate.

Methods

MethodSignatureClass
getScaleBarProperties(length: number, measurementSystem: MeasurementSystem): any | null | undefined

getScaleBarProperties

Method
Signature
getScaleBarProperties (length: number, measurementSystem: MeasurementSystem): any | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.31

Computes the size and units of the scale bar widget given a base length in pixels.

Parameters
ParameterTypeDescriptionRequired
length

The base width of the scale bar widget in pixels.

measurementSystem

The measurement system to use.

Returns
any | null | undefined
PropertyTypeDescription
lengthnumberAdjusted length of the scale bar widget in pixels.
valuenumberThe length of the scale bar in map units.
unit"millimeter" | "centimeter" | "meter" | "kilometer" | "inch" | "foot" | "mile"The map units to use on the scale bar.

Type definitions

ScaleBarViewModelState

Type definition
Type
"disabled" | "ready"