UNPKG

@arcgis/core

Version:

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

189 lines (187 loc) 8.16 kB
import type LabelClass from "./LabelClass.js"; import type { ClonableMixin } from "../../core/Clonable.js"; import type { JSONSupport } from "../../core/JSONSupport.js"; import type { RendererUnion } from "../../renderers/types.js"; import type { LabelClassProperties } from "./LabelClass.js"; import type { HeatmapRendererProperties } from "../../renderers/HeatmapRenderer.js"; import type { PieChartRendererProperties } from "../../renderers/PieChartRenderer.js"; import type { DictionaryRendererProperties } from "../../renderers/DictionaryRenderer.js"; import type { DotDensityRendererProperties } from "../../renderers/DotDensityRenderer.js"; import type { UniqueValueRendererProperties } from "../../renderers/UniqueValueRenderer.js"; import type { ClassBreaksRendererProperties } from "../../renderers/ClassBreaksRenderer.js"; import type { SimpleRendererProperties } from "../../renderers/SimpleRenderer.js"; export interface TrackPartInfoProperties extends Partial<Pick<TrackPartInfo, "labelsVisible" | "visible">> { /** * Defines labels for the track part as an array of * [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). When set, labels * independent of the [layer.labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#labelingInfo) are used * to convey information about the track. * * Any aggregate field defined in [TrackInfo.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#fields) can be referenced in the label. * * Multiple Label classes with different `where` clauses can be used to define several * labels with varying styles on the same track part. Likewise, multiple label classes * may be used to label different types of track parts (e.g. green labels * for fast observations and red labels for slow observations). * * @example * // Displays the observation count of the track * layer.trackInfo = { * fields: [{ * name: "total_observations", * statisticType: "count" * }], * trackLines: { * labelingInfo: [{ * labelExpressionInfo: { * expression: "$feature.total_observations" * }, * symbol: { * type: "text", * color: "white", * font: { * size: "12px" * }, * haloSize: 1, * haloColor: "black" * } * }] * } * }; */ labelingInfo?: LabelClassProperties[] | null; /** * The renderer used to style the track part. Depending on the renderer type, * features may be visualized with the same symbol or with varying symbols * based on the values of the provided fields. * * @example * layer.trackInfo = { * previousObservations: { * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", // autocasts as new SimpleFillSymbol() * outline: { // autocasts as new SimpleLineSymbol() * width: 0.5, * color: "white" * } * }, * visualVariables: [{ * type: "color", * field: "speed", * stops: [ * { value: 5, color: "red" }, * { value: 45, color: "green" } * ] * }] * } * } * }; */ renderer?: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null; } /** * TrackPartInfo provides information about how to render and label temporal data in a layer. * This information includes how to render the latest observations, previous observations, and track lines. * * @beta * @since 4.32 * @see [TrackInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/) */ export default class TrackPartInfo extends TrackPartInfoSuperclass { constructor(properties?: TrackPartInfoProperties); /** * Defines labels for the track part as an array of * [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). When set, labels * independent of the [layer.labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#labelingInfo) are used * to convey information about the track. * * Any aggregate field defined in [TrackInfo.fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackInfo/#fields) can be referenced in the label. * * Multiple Label classes with different `where` clauses can be used to define several * labels with varying styles on the same track part. Likewise, multiple label classes * may be used to label different types of track parts (e.g. green labels * for fast observations and red labels for slow observations). * * @example * // Displays the observation count of the track * layer.trackInfo = { * fields: [{ * name: "total_observations", * statisticType: "count" * }], * trackLines: { * labelingInfo: [{ * labelExpressionInfo: { * expression: "$feature.total_observations" * }, * symbol: { * type: "text", * color: "white", * font: { * size: "12px" * }, * haloSize: 1, * haloColor: "black" * } * }] * } * }; */ get labelingInfo(): LabelClass[] | null | undefined; set labelingInfo(value: LabelClassProperties[] | null | undefined); /** * Indicates whether to display labels for the track. If `true`, labels will * appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TrackPartInfo/#labelingInfo) property. * * @default true * @example * // Turns off track labels, but preserves labelingInfo * const trackInfo = layer.trackInfo.clone(); * trackInfo.labelsVisible = false; * layer.trackInfo = trackInfo; */ accessor labelsVisible: boolean; /** * The renderer used to style the track part. Depending on the renderer type, * features may be visualized with the same symbol or with varying symbols * based on the values of the provided fields. * * @example * layer.trackInfo = { * previousObservations: { * renderer: { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", // autocasts as new SimpleFillSymbol() * outline: { // autocasts as new SimpleLineSymbol() * width: 0.5, * color: "white" * } * }, * visualVariables: [{ * type: "color", * field: "speed", * stops: [ * { value: 5, color: "red" }, * { value: 45, color: "green" } * ] * }] * } * } * }; */ get renderer(): RendererUnion | null | undefined; set renderer(value: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null | undefined); /** * Indicates whether the renderer of the track part is visible. * * @default true * @example * // Hides the renderer * trackPartInfo.visible = false; */ accessor visible: boolean; } declare const TrackPartInfoSuperclass: typeof JSONSupport & typeof ClonableMixin