UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

34 lines (32 loc) 1.64 kB
import type { JSONSupport } from "../../core/JSONSupport.js"; /** @since 5.0 */ export interface LabelExpressionInfoProperties extends Partial<Pick<LabelExpressionInfo, "expression" | "title">> {} /** @since 5.0 */ export default class LabelExpressionInfo extends JSONSupport { constructor(properties?: LabelExpressionInfoProperties); /** * An [Arcade](https://developers.arcgis.com/javascript/latest/arcade/) expression following the specification * defined by the [Arcade Labeling Profile](https://developers.arcgis.com/javascript/latest/arcade/#labeling). Expressions * in labels may reference field values using the `$feature` profile variable and must return a string. * * For example, to label a layer * of cities with their names, simply reference the field value with the global * variable: `$feature.CITY_NAME`. Expressions can be more sophisticated and use * logical functions. This may be useful if you want to use classed labels. * For example, the following expression appends `city` to the end of the label * if the feature's population field contains a number greater than 10,000. Otherwise, * `town` is appended to the end of the label. Additionally, you can use `TextFormatting.NewLine` * to add a new line to the label. * * `IIF($feature.POPULATION > 10000, $feature.NAME + ' city', $feature.NAME + ' town')` * * @since 5.0 */ accessor expression: string | null | undefined; /** * The title of the label expression. This is particularly useful in the case of multiple label classes. * * @since 5.0 */ accessor title: string | null | undefined; }