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.
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.
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.