Hello everyone,
I was working on the following example while adding some additional features:
https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-binning/
My question: Is there a way to retrieve via the API the minimum and maximum of all the aggregations found on the map?
Thank you in advance for your answer.
Solved! Go to Solution.
Yes. You can use those values in your stops. You first have to initialize binning then query the bins before creating the stops for the renderer. You can do this on your own using the summaryStatistics method, or you can use the smart mapping renderer creators to generate the stops for you based on the statistics.
https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-color.html
It's the same parameters, but instead of outputting stats, it outputs a renderer.
Yes. You can do this with the smartMapping statistic functions. In this case you need summaryStatistics. You can also get a histogram and unique values with count if needed. You just need to be sure to set the forBinning parameter to true.
const stats = await summaryStatistics({
layer,
view,
field: "aggregateCount",
forBinning: true
});
Here's a codepen that demonstrates how to do it for the basic configuration sample you posted: https://codepen.io/kekenes/pen/bGmEvWj?editors=1000 Let me know if you run into issues.
@KristianEkenes Thank you Kristian, it works, I am able to retrieve these values. However, the initial idea was to be able to put them in the Stops as values.
Yes. You can use those values in your stops. You first have to initialize binning then query the bins before creating the stops for the renderer. You can do this on your own using the summaryStatistics method, or you can use the smart mapping renderer creators to generate the stops for you based on the statistics.
https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-color.html
It's the same parameters, but instead of outputting stats, it outputs a renderer.
It worked well. Thank you Kristian.
@KristianEkenes Can we apply the function that allows us to browse the entities, which is present in the following example :
https://developers.arcgis.com/javascript/latest/visualization/high-density-data/aggregation/
I tried, but the issue is that the number of aggregations is not consistent with what can be browsed in the POPUP.
Thank you for your help.