UNPKG

@arcgis/core

Version:

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

52 lines (51 loc) 2.86 kB
/** * Generates a histogram based on data in a [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/) for a given field. * The returned object can be used for displaying * a histogram in the UI within visualization authoring applications and analytical apps that query and * display statistics. * * > [!WARNING] * > * > **Known Limitations** * > * > [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) must have the `supportsRenderer` and `supportsLayerQuery` capabilities enabled unless a predefined [statistics](https://developers.arcgis.com/javascript/latest/references/core/smartMapping/statistics/types/#SummaryStatisticsResult) object is provided to the `statistics` parameter of the method. To check a SceneLayer's capabilities, use the [SceneLayer.getFieldUsageInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/#getFieldUsageInfo) method. * > You cannot generate statistics using SQL expressions for client-side [FeatureLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) * > in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * > The `normalizationType` parameter only normalizes data returned by a `field`. It does not apply to values returned from a `valueExpression` or `sqlExpression`. * * @since 4.2 */ import type { HistogramParameters, HistogramResult } from "./types.js"; /** * Generates a histogram for data returned from a `field` in a given `layer`. * The returned object can be used for displaying * a histogram to the UI in visualization authoring applications and analytical apps that query and * display statistics. * * @param parameters - The function parameters. * @returns Resolves to a [HistogramResult object](https://developers.arcgis.com/javascript/latest/references/core/smartMapping/statistics/types/#HistogramResult). * @example * histogram({ * layer: featureLayer, * valueExpression: "( ($feature.POP2020 - $feature.POP2010) / $feature.POP2010 ) * 100" * view: mapView, * numBins: 30 * }).then((histogramResult) => { * colorSlider.histogram = histogramResult; * }); * @example * histogram({ * layer: featureLayer, * field: "Population", * normalizationType: "natural-log", * sqlWhere: "Population > 0", * numBins: 100 * }).then((histogramResult) => { * const histogramElement = document.createElement("arcgis-histogram"); * // Set histogram properties based on the histogramResult * histogramElement.min = histogramResult.minValue; * histogramElement.max = histogramResult.maxValue; * histogramElement.bins = histogramResult.bins; * }); */ export default function histogram(parameters: HistogramParameters): Promise<HistogramResult>;