This sample demonstrates how to use the arcgis-slider-histogram-range component to filter a layer’s features based on a numeric attribute. Its histogram bins are generated with the histogram() statistics function.

const field = "temp";
const min = 0;
const max = 30;
// create the histogram for the temperature field
const histogramResponse = await histogram({
layer: layer,
field: field,
numBins: 100,
minValue: min,
maxValue: max,
});

Then use updateFromHistogramResult() to configure the component from the result and update the layer view filter as the range changes.

// set the histogram properties
await histogramRangeSlider.updateFromHistogramResult(histogramResponse);
// when the slider values change, update the histogram and apply a feature effect
histogramRangeSlider.addEventListener("arcgisInput", async (event) => {
layerView.filter = { where: await histogramRangeSlider.generateWhereClause(field) };
});
3DfilterFeatureLayerFeatureLayerViewcommon-componentsviewOnReadyarcgis-compassarcgis-expandarcgis-navigation-togglearcgis-scenearcgis-slider-histogram-rangearcgis-zoommap-componentscalcite-blockcalcite-panelcalcite-components5.2