▾
import LabelOptions from "@arcgis/core/views/interactive/options/LabelOptions.js";const LabelOptions = await $arcgis.import("@arcgis/core/views/interactive/options/LabelOptions.js");- Inheritance
- LabelOptions→
Accessor
- Subclasses
- SketchLabelOptions
- Since
- ArcGIS Maps SDK for JavaScript 5.2
The LabelOptions class allows users to configure the labels which are shown next to each
segment of a graphic while sketching, editing or placing analyses. The labels display each segment's
horizontal length and are not shown for non-planar polygons and polylines.
How the segment lengths are computed depends on the view's spatial reference. In geographic coordinate systems (GCS) and in Web Mercator, the lengths are computed geodetically. In projected coordinate systems (PCS), apart from Web Mercator, the lengths are computed in a Euclidean manner (in the respective PCS).
Set the unit system for labels
Use either a Portal or PortalItem to establish the unit system for labels while sketching, editing, or placing analyses.
Read More
The unit of measurement used in the labels can be programmatically set through the PortalItem of a Map by defining the Portal.units property.
// Create a PortalItem instance for the map used in the 3D viewview.map.portalItem = new PortalItem({ portal: { units: "english" // or "metric" },});Or, if a PortalItem already exists, the Portal.units property can be directly set or changed.
// Set the units directly on an existing PortalItem of the 3D viewview.map.portalItem.portal.units = "english" // or "metric"Alternatively, if no Portal exists, you can set the Portal.units property
from a new default Portal created using the Portal.getDefault() method.
// Create a new Portal instance and set its unitsconst portal = Portal.getDefault();portal.units = "english" // or "metric"Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| readonly inherited | ||
| |
enabled
- Type
- boolean
Whether labels are shown next to each segment of a geometry while sketching, editing, or placing analyses.
- Default value
- false
