laptop and a wrench

Bug

The renderer being generated via the 'colorRendererCreator.createClassBreaksRenderer()' method shows inconsistent behavior in ArcGIS Maps SDK for JavaScript 4.30.

ArcGIS Maps SDK for JavaScript
Bug ID Number BUG-000169933
SubmittedAugust 13, 2024
Last ModifiedDecember 6, 2024
Applies toArcGIS Maps SDK for JavaScript
Version found4.30
Operating SystemWindows OS
Operating System Version10.0 64 Bit
StatusKnown Limit

Additional Information

This is by design for performance reasons. Arcade is used as the data input for generating the renderer. Arcade executes client-side and therefore all data referenced in Arcade expressions should be available on the client. On the first pass of generating the renderer, the client does not have the attributes required for executing the expression. So the generate renderer function samples features from the service that includes the required data. The expression then executes client-side and a renderer is generated for the entire renderer. On the second pass, the data is already available on the client. For that reason, there is no need to query a sample of features for generating the renderer. The data is queried client-side using a layer view query and breaks are generated from that result. Unfortunately layer view queries only consider data that is visible in the view. In this case, only four features are available in the view and therefore the function cannot generate five class breaks. It can only generate a max of four breaks. It also only considers those four features in generating those breaks, so the breaks themselves are different than when sampling from the whole dataset. To observe this, zoom out and all other features are excluded from the class breaks. Generally speaking, always author a renderer at the scale the renderer is most likely to be viewed at. For this reproduction case, if the renderer for a layer representing U.S. States is generated, then the interface zoomed to the extent of the U.S. states when creating the renderer.

Workaround

There are a couple of ways to work around this issue. If using a basic expression like the one provided, set field and normalizationField in the function, and the renderer generates consistently every time because server queries are always used against the whole dataset. If Arcade is required, zoom to the widest extent where the data is most likely to be viewed.

In the example provided, it is supposed to be zoomed to the extent of the United States (since it is a state layer). Regenerate the renderer there and breaks consistent with the first generation can be seen. Generally speaking, it is not a good practice to generate styles at very large scales (zoomed in) when it is possible to view more data at smaller scales.

Steps to Reproduce

Bug ID: BUG-000169933

Software:

  • ArcGIS Maps SDK for JavaScript

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options