ArcGIS JS API: Heat-map based on dynamic sum of multiple fields

387
2
10-18-2019 11:21 AM
HanlunSong
New Contributor II

I have a service that gives a layer that has many fields. How do I use the JS API to dynamically display a heat-map with color based on the sum of two or more fields? It does not have to be strictly creating a new field on the fly if that's impossible, as long as I can display the color of polygon for each heat-map feature based on the sum of multiple fields for each feature.

Thanks.

Update: I am able to achieve the above using Arcade Expression and Renderers. 

Tags (1)
0 Kudos
2 Replies
LandonJohnson1
New Contributor

Try this:

1. Select "Change Style"

2. Select the "Choose an attribute to show" drop-down menu, scroll to the bottom of the list, and select "New Expression"

3. Enter the following under "Expression" on line 1:

Sum($feature["Associate_s_degree"], $feature["Bachelor_s_degree"])

4. Select "OK"

5. Select "Counts and Amounts (Color)" as your drawing style.

That should get you the heat map you are looking for.

0 Kudos
HanlunSong
New Contributor II

Thanks for the reply!

I think you are talking about desktop or online version?

But I need to use the JS API to render a web map on the fly. So the sum and display needs to be dynamically done.

0 Kudos