Exclude some data in a classBreaksDefinition, but still symbolize those records

1925
1
Jump to solution
07-03-2014 10:44 AM
TracySchloss
Frequent Contributor
In Desktop, when symbolizing by a numeric value, not only can you specify classification method, interval, field etc, there's also a place to exclude some records.  I routinely have data with a value of -999 to indicate 'no data'.  In desktop, I can exclude those records from the classification calculation and still have a symbol on them that I can show on the map and legend.

I don't see that I can do the same thing with the objects available for classbreaksdefinition and generateRendererTask.  If I exclude my 'no data', using a where clause, my classification calculates just fine, but they are completely eliminated from the display.  That isn't what I want to see.  I can't have those -999 in the calculations, that just gives weird breaks, but I still show them with some 'no data' symbol, not have them completely gone. 

Am I missing something?  It seems like I should be able to do this.  I could probably make a second set of function just to display these no data records, but that sounds rather messy.
0 Kudos
1 Solution

Accepted Solutions
TracySchloss
Frequent Contributor
The answer to this was as clear as mud, I just happened to try this and it worked.

When you specify your classDefinition, there's a place there to set your defaultSymbol. I had one defined based on the example https://developers.arcgis.com/javascript/jssamples/renderer_dynamic_layer_change_attribute.html

When you execute the generateRendererTask, the resultant renderer doesn't have a default symbol assigned to it anymore. I don't know if this in intentional or something that is broken in the task.

Before I applied this symbology to my layer, I manually went in and set the default symbol again on the renderer.

  function applyRenderer(renderer) {       var optionsArray = [];     renderer.defaultSymbol = defaultSymbol;     var drawingOptions = new LayerDrawingOptions();     drawingOptions.renderer = renderer;      optionsArray[0] = drawingOptions;     myLayer.setLayerDrawingOptions(optionsArray);    }


Now my excluded values of -999 are symbolized with that default and not just blank.

View solution in original post

0 Kudos
1 Reply
TracySchloss
Frequent Contributor
The answer to this was as clear as mud, I just happened to try this and it worked.

When you specify your classDefinition, there's a place there to set your defaultSymbol. I had one defined based on the example https://developers.arcgis.com/javascript/jssamples/renderer_dynamic_layer_change_attribute.html

When you execute the generateRendererTask, the resultant renderer doesn't have a default symbol assigned to it anymore. I don't know if this in intentional or something that is broken in the task.

Before I applied this symbology to my layer, I manually went in and set the default symbol again on the renderer.

  function applyRenderer(renderer) {       var optionsArray = [];     renderer.defaultSymbol = defaultSymbol;     var drawingOptions = new LayerDrawingOptions();     drawingOptions.renderer = renderer;      optionsArray[0] = drawingOptions;     myLayer.setLayerDrawingOptions(optionsArray);    }


Now my excluded values of -999 are symbolized with that default and not just blank.
0 Kudos