AnsweredAssumed Answered

smartMapping.createClassedColorRenderer legend color and Other symbol

Question asked by mshukun1 on Sep 26, 2018

How can I change the legend color of the smartMapping.createClassedColorRenderer?

I was able to change the symbol color of the map but the legend doesn't show the correct color (see an image below).  The legend color appears to be the same color.  How can I change it?  Did I do something wrong on setVisualVariables or something else?  Also, I couldn't find the way to remove 'Other' in legend.  How can I remove it?

Your input would be greatly appreciated.

 

 

I used the Sandbox code to test.

 

 function createRenderer(field) {
   let colorRgb = [[62, 32, 79], [90, 69, 101], [206, 201, 214],
   [226, 219, 233], [188, 174, 204]]
     //smart mapping functionality begins
     smartMapping.createClassedColorRenderer({
        layer: layer,
        field: field,
        basemap: map.getBasemap(),
        classificationMethod: "quantile"
     }).then(function (response) {
       let breaks = response.renderer.breaks;
       let stops = breaks.map((b, i) => {
          let data = {value: b[1],
            color: colorRgb[i]
          }
          return data;
       });
       response.renderer.setVisualVariables([{
           type: 'colorInfo',
           field: field,
           legendOptions: {showLegend: false},
           stops: stops
        }
       ]);
        layer.setRenderer(response.renderer);
        layer.redraw();
        createLegend(map, layer, field);
     });
}

Outcomes