Skip to content

This sample visualizes cities in Mexico by population and demonstrates how to visualize the distribution of the data using a Histogram component.

The histogram can be generated with the histogram() statistics function, then set the min, max, and bins on the Histogram component.

<arcgis-histogram layout="horizontal"></arcgis-histogram>
const histogramElement = document.querySelector("arcgis-histogram");
const params = {
layer: layer,
field: "pobtot",
numBins: 30,
};
const histogramResult = await histogram(params);
// Set histogram properties based on the histogramResult
histogramElement.min = histogramResult.minValue;
histogramElement.max = histogramResult.maxValue;
histogramElement.bins = histogramResult.bins;

You can also specify a normalizationType to normalize skewed histograms. For example, a histogram representing a total count, such as population, will typically be skewed to the right.

histogram-skew

Normalizing the data by natural-log may help you work with and understand the data better.

histogram-nl