How do I change the default label in a ClassBreaksRenderer from "others"?

1800
3
Jump to solution
03-23-2016 08:07 AM
DavidChevrier
Occasional Contributor II

I can't seem to locate how to change the default label of the ClassBreaksRenderer.  I can change the symbol, but not the label for the legend for data that does not fall within the scope of the breaks.

0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor

It looks like you can use the defaultLabel property to modify the others value. Doesn't look like its doc'd for ClassBreaksRenderer but it is for UniqueValueRenderer. I tested it with ClassBreaksRenderer and in my testing it worked. Here's a bit of code that shows how I set the property.

        var renderer = new ClassBreaksRenderer(symbol, "POP07_SQMI");
        renderer.addBreak(20, 25, new SimpleFillSymbol().setColor(new Color([56, 168, 0, 0.5])));
        renderer.addBreak(25, 75, new SimpleFillSymbol().setColor(new Color([139, 209, 0, 0.5])));
        renderer.addBreak(75, 175, new SimpleFillSymbol().setColor(new Color([255, 255, 0, 0.5])));
        renderer.addBreak(175, 400, new SimpleFillSymbol().setColor(new Color([255, 128, 0, 0.5])));
        renderer.addBreak(400, Infinity, new SimpleFillSymbol().setColor(new Color([255, 0, 0, 0.5])));
        renderer.defaultLabel = "Not Matched";

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

David,

  I have looked high and low and have not found any way to change it. I looked for the default string of "others" in the esriBundle and it is not there so I don't know where it is coming from to change it. I have checked all the properties of ClassBreakRenderer and there is nothing there even in the private underscore properties or methods.

Maybe Kelly Hutchins​ can shed some light.

0 Kudos
KellyHutchins
Esri Frequent Contributor

It looks like you can use the defaultLabel property to modify the others value. Doesn't look like its doc'd for ClassBreaksRenderer but it is for UniqueValueRenderer. I tested it with ClassBreaksRenderer and in my testing it worked. Here's a bit of code that shows how I set the property.

        var renderer = new ClassBreaksRenderer(symbol, "POP07_SQMI");
        renderer.addBreak(20, 25, new SimpleFillSymbol().setColor(new Color([56, 168, 0, 0.5])));
        renderer.addBreak(25, 75, new SimpleFillSymbol().setColor(new Color([139, 209, 0, 0.5])));
        renderer.addBreak(75, 175, new SimpleFillSymbol().setColor(new Color([255, 255, 0, 0.5])));
        renderer.addBreak(175, 400, new SimpleFillSymbol().setColor(new Color([255, 128, 0, 0.5])));
        renderer.addBreak(400, Infinity, new SimpleFillSymbol().setColor(new Color([255, 0, 0, 0.5])));
        renderer.defaultLabel = "Not Matched";
DavidChevrier
Occasional Contributor II

Thanks!

0 Kudos