Select to view content in your preferred language

How to control visual variable names when updating renderer / cluster config, and possible bug

161
0
a month ago
mleahy_cl
Regular Contributor

Hi all,

I find that I am unable to control the automatic 'Number of features' text that appears above the automatic cluster size rendering (i.e., when I allow the cluster config to automatically define the size variable based on the cluster count).  Is there a way that this can be done without defining a custom renderer that has a static visual variable defined for the cluster size?

What's even more complicating, is that I think there is a bug when applying the feature reduction config with the automatic visual variable size: if I then turn off the feature reduction, the 'Number of features' label appears to be stuck in the legend. I find this happens both when I just turn the feature reduction by setting the featureReduction property to null, and when I also do that plus set the layer's renderer property to a new renderer.  In either case, if the layer's renderer has a size variable with a title defined in its legendOptions property, it remains labelled as 'Number of Features' in the actual legend widget.

I have demonstrated this in the following codePen: https://codepen.io/mleahy_cl/pen/mdNbrxM

When you open that, the sample app will start with a simple renderer that has a visual variable, and in the legend you'll see it has a title pre-defined.

Once you enable clustering, the label in the legend switches to 'Number of Features' (which I would like to override...in particular, this is because in the application I'm working on, the things depicted on the map are not called 'Features' by our end users).  Does anyone know how I can control this?

Now, disable the clustering...and notice that the original renderer is restored, as is the visual variable...but *not* its label.  It still says 'Number of Features'.

Is this expected, and/or does anyone have a suggestion for how it may be controlled?

Worst case, I could destroy and recreate the entire feature layer...but that seems like a last resort option. 

0 Kudos
0 Replies