Changing renderer with valueExpression not causing map update.

611
3
10-05-2018 06:43 AM
MatthewHuska
New Contributor

Several items in my application hinge on being able to change the function used to calculate values for a renderer's visual variables.  In ArcGIS Javascript API 4.9, assigning a function to the "field" property, as I had previously done, is no longer an option.  

I created an Arcade expression as suggested in Release notes for 4.9 | ArcGIS API for JavaScript 4.9 and it only works the first time you assign it.  After that, assigning a new renderer with a new Arcade expression does not work.  It doesn't seem to recognize that anything changed in the renderer, even though I can inspect it through the console and see that the valueExpression did change.  

0 Kudos
3 Replies
MatthewHuska
New Contributor

I found that this problem only seems to occur for Simple renderers.  My unique renders update as expected when changing the valueExpression.

0 Kudos
KristianEkenes
Esri Regular Contributor

Hi Matt,

Can you provide a link to a small app that demonstrates this issue?

Thanks.

0 Kudos
MatejVrtich
Esri Contributor

Hi Kristian,

I'm dealing with similar issue.

Using SizeVisualVariable with valueExpression on SimpleRenderer, I'm trying to render StreamLayer features based on time elapsed since Date.now().

Here you can find a small sample app: StreamLayer rendered by time 

I would expect that more current features are larger, then older ones, however it does not happen.

There are two valeExpressions in the samle app. If you uncomment the default one and use the other one, size changes, but only after map zoom change. The only difference is in use of timestamp variable passed in createRenderer call. I need to use this pattern to let the user change the rendering using e.g. time slider UI component.

What is the best practice to render features by time using visual variables and change the rendering periodically?

Thanks,

Matej

0 Kudos