▾
import "@arcgis/map-components/components/arcgis-utility-network-trace-results";- Inheritance
- ArcgisUtilityNetworkTraceResults→
HTMLElement
- Since
- ArcGIS Maps SDK for JavaScript 5.2
The Utility Network Trace Results component displays the outcome of a single utility network trace, including its results, an empty result, or an error.
This component displays results for the following trace result types: elements, aggregated geometries, and functions.
Each result type is displayed by a result item component. By default, this component displays the result items for the result types returned by the trace. To choose which result items are displayed or configure their properties individually, add the elements result item, aggregated geometry result item, or functions result item to this component's default slot. When the default slot has content, the component displays the slotted content instead of the default result items.
Use in the trace analysis component's results slot
By default, the arcgis-utility-network-trace-analysis component displays aggregated geometry,
elements, and functions in its results tab when those result types are returned by the trace.
You do not need to slot a results component for this default display configuration. Only slot this component into
the trace analysis component's results slot when you want to customize the result items in the results tab:
choose which items are displayed, configure their properties, or add custom result items.
When this component is slotted into the results slot of the trace analysis component,
the parent trace analysis component sets the
trace result,
trace error,
utility network, and
view properties.
See the custom result items example.
Use in a custom app outside the trace analysis component
See arcgis-utility-network-trace-results-pane for guidance and examples of displaying multiple trace results outside the trace analysis component.
- Examples
The following example customizes the display of element results. Other result types are not displayed because the component's default slot contains only an element result item.
<arcgis-map item-id="471eb0bf37074b1fbb972b1da70fb310"><arcgis-utility-network-trace-analysis slot="bottom-left"><arcgis-utility-network-trace-results slot="results"><arcgis-utility-network-trace-elements-result-itemheading="Feature results"hide-action-bar></arcgis-utility-network-trace-elements-result-item></arcgis-utility-network-trace-results></arcgis-utility-network-trace-analysis></arcgis-map>Using the markup above, register these listeners before running a trace to respond to result and error changes and access queried features after all result items finish processing.
const results = document.querySelector("arcgis-utility-network-trace-results");results.addEventListener("arcgisPropertyChange", (event) => {if (event.target !== results) {return;}if (event.detail.name === "traceResult") {console.log("Trace result:", results.traceResult);} else if (event.detail.name === "traceError") {if (results.traceError) {console.error("Trace error:", results.traceError);}}});results.addEventListener("arcgisResultsReady", () => {console.log("Result items ready:", results.traceResultFeatures);});
Properties
| Property | Attribute | Type |
|---|---|---|
| | ArcgisFeaturesNext["actions"] | undefined | |
| aggregated-geometry-results-graphics-color | ||
| aggregated-geometry-results-size | ||
| auto-destroy-disabled | ||
| disable-highlight-feature-results | ||
| expandable | ||
| expanded | ||
| heading | ||
| hide-action-bar | ||
| hide-feature-results | ||
| hide-graphics | ||
| hide-placeholder | ||
| include-default-actions-disabled | ||
| | Layer[] | |
| | ||
| readonly | | |
| reference-element | ||
| readonly | | |
| | ||
| | ||
| readonly | | Graphic[] |
| | ||
| |
actions
- Type
- ArcgisFeaturesNext["actions"] | undefined
A collection of action button or action toggle objects. Each action may be executed by clicking the icon or image symbolizing them.
There is a default Zoom To action styled with a magnifying glass icon to zoom in four LODs and center the map on the selected feature. This default action can be removed by setting includeDefaultActionsDisabled to true, or by setting the overwriteActions property to true in a PopupTemplate.
The order of each action is the order in which they appear in the actions Collection. The @arcgisTriggerAction event fires each time an action is clicked.
aggregatedGeometryResultsGraphicsColor
- Type
- Color
The color used to render graphics for aggregated geometries in trace results, specified as a Color object.
Aggregated geometry is only rendered if the trace configuration specifies aggregated geometry as a result type. The default is yellow with 0.6 opacity.
- Attribute
- aggregated-geometry-results-graphics-color
aggregatedGeometryResultsSize
- Type
- number
The size in points used to render graphics for aggregated geometries in trace results.
Aggregated geometry is only rendered if the trace configuration specifies aggregated geometry as a result type.
The default is 12.
- Attribute
- aggregated-geometry-results-size
- Default value
- 12
autoDestroyDisabled
- Type
- boolean
If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy() method when you are done to prevent memory leaks.
- Attribute
- auto-destroy-disabled
- Default value
- false
- Example
- <arcgis-utility-network-trace-results auto-destroy-disabled></arcgis-utility-network-trace-results>utilityNetworkTraceResultsElement.autoDestroyDisabled = true;
disableHighlightFeatureResults
- Type
- boolean
Whether to disable highlighting trace result features on the map.
Disabling highlights does not prevent the component from querying features or affect aggregated geometry graphics.
- Attribute
- disable-highlight-feature-results
- Default value
- false
expandable
- Type
- boolean
Whether the component can be expanded and collapsed.
- Attribute
- expandable
- Default value
- false
expanded
- Type
- boolean
Whether the component and its contents are expanded when
expandable is true.
- Attribute
- expanded
- Default value
- false
hideActionBar
- Type
- boolean
Whether to hide the action bar that holds the feature's arcgis-features-next.actions when viewing trace result features.
- Attribute
- hide-action-bar
- Default value
- false
hideFeatureResults
- Type
- boolean
Whether to hide the elements result item and its features list.
When true, the component displays a placeholder instead. Features are still queried and remain available from
traceResultFeatures. This property does not disable
highlighting; use disableHighlightFeatureResults to hide
feature highlights.
- Attribute
- hide-feature-results
- Default value
- false
hideGraphics
- Type
- boolean
Whether to hide the aggregated geometry graphics from the map when the trace result contains aggregated geometry results.
Hidden graphics remain available from the arcgis-utility-network-trace-aggregated-geometry-result-item component.
- Attribute
- hide-graphics
- Default value
- false
hidePlaceholder
- Type
- boolean
Whether to hide the placeholder shown when feature results are hidden.
When this property and hideFeatureResults are both set to true,
nothing is rendered for trace result elements. However, features are still queried and are available through
traceResultFeatures.
- Attribute
- hide-placeholder
- Default value
- false
includeDefaultActionsDisabled
- Type
- boolean
Whether default actions are disabled (hidden) when viewing trace result features.
This property must be set to true to disable default actions.
- Attribute
- include-default-actions-disabled
- Default value
- false
layers
- Type
- Layer[]
The utility network layers and tables used to query trace result features.
When the array is empty, the component uses layers and tables in the map that belong to utilityNetwork. Entries that do not belong to that utility network are ignored.
Set this property before assigning a trace result. Changing it does not requery the current result or restrict highlighting.
numFeatureResults
- Type
- number
The number of successfully queried features plus unique trace elements without a matching layer in the map.
If the default slot contains multiple arcgis-utility-network-trace-elements-result-item components, this property returns the result count from the first one. This value can be lower than the number of elements returned by the trace when feature queries fail or return no matching features.
referenceElement
- Type
- ArcgisReferenceElement | string | undefined
By assigning the id attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
- Attribute
- reference-element
traceError
- Type
- EsriError<TraceErrorDetails> | undefined
The error returned when the trace could not be completed.
When set, the component displays the error instead of traceResult. Changes emit @arcgisPropertyChange.
traceResult
- Type
- TraceResult | undefined
The trace result to display.
Assigning a new value clears side effects from the previous result and starts a new processing cycle. It does not emit @arcgisTraceResultClear. Changes emit @arcgisPropertyChange.
traceResultFeatures
- Type
- Graphic[]
The features successfully queried for the current trace result elements.
Read this property after @arcgisResultsReady fires. Elements without a matching query layer are not included. If the default slot contains multiple arcgis-utility-network-trace-elements-result-item components, this property returns features from the first one.
utilityNetwork
- Type
- UtilityNetwork | undefined
The utility network used to resolve trace result elements to features.
Methods
| Method | Signature |
|---|---|
| clearResults(): void | |
| inherited | componentOnReady(): Promise<this> |
| destroy(): Promise<void> |
clearResults
- Signature
-
clearResults (): void
Clears side effects created by the result items, resets
state to "ready", and emits
@arcgisTraceResultClear.
Clears traceResult and traceError values.
- Returns
- void
componentOnReady
- Signature
-
componentOnReady (): Promise<this>
Creates a promise that resolves once the component is fully loaded.
- Returns
- Promise<this>
- Example
- const arcgisUtilityNetworkTraceResults = document.createElement("arcgis-utility-network-trace-results");document.body.append(arcgisUtilityNetworkTraceResults);await arcgisUtilityNetworkTraceResults.componentOnReady();console.log("arcgis-utility-network-trace-results is ready to go!");
Events
| Name | Type |
|---|---|
| CustomEvent<{ name: "aggregatedGeometryResultsGraphicsColor" | "aggregatedGeometryResultsSize" | "hideGraphics" | "state" | "traceError" | "traceResult" | "utilityNetwork" | "view"; }> | |
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "aggregatedGeometryResultsGraphicsColor" | "aggregatedGeometryResultsSize" | "hideGraphics" | "state" | "traceError" | "traceResult" | "utilityNetwork" | "view"; }> Emitted when the value of a property is changed. Use this to listen to changes to properties.
arcgisResultsReady
arcgisResultsReady: CustomEvent<void> Fires when all participating result items finish processing the current traceResult, including when processing produces no results or a result item fails.
Calling clearResults() during processing does not emit this event.
arcgisTraceResultClear
arcgisTraceResultClear: CustomEvent<void> Fires when clearResults() is called. Replacing or clearing traceResult directly does not emit this event.
arcgisTriggerAction
arcgisTriggerAction: CustomEvent<ActionEvent> Emitted when an action is triggered on the component.
Slots
| Name | Description |
|---|---|
| Default slot for adding trace result items or custom content. Slotted content replaces the component's default result items. |