▾
import { getGraphicOriginTitle } from "@arcgis/core/graphic/getGraphicOriginTitle.js";const { getGraphicOriginTitle } = await $arcgis.import("@arcgis/core/graphic/getGraphicOriginTitle.js");- Since
- ArcGIS Maps SDK for JavaScript 5.2
Provides utility method for getting the title of the layer or sublayer a graphic came from.
Functions
getGraphicOriginTitle
Function
Returns a title that identifies the origin of a graphic. Use the returned title to show users which layer or sublayer a graphic came from when displaying query or hitTest results.
If the origin's sublayer has a title property, the function returns that value. Otherwise, it returns the origin's layer title if the layer has a title property.
For example, for a graphic from a sublayer titled "Roads" in a layer titled "Transportation", the function returns "Roads".
- Signature
-
getGraphicOriginTitle (origin: GraphicOrigin): string | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| origin | The origin information associated with a graphic. See Graphic.origin. | |
- Example
Get the origin title of a graphic returned by a hit test or query.
if (graphic.origin) {const title = getGraphicOriginTitle(graphic.origin);console.log(title);}