Does "null" value matters when using Class Break Renderer?

Discussion created by dewflower on Nov 8, 2012
Latest reply on Mar 14, 2016 by Yue_Wu-esristaff
Hi, all

I am working on an application similar to the equal interval break demo at: I was able to get the break value but not able to add the breaks to the renderer.  I can only get the default symbols to show on my map.

The attribute field I am working with contains some null values.Could that be the problem?

here is the code of the rendering function.

Any ideas? thanks.


 function initOperationalLayer() {
          featureLayer = new esri.layers.FeatureLayer("http://..../MapServer/0", {
          mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
          outFields: ["*"],
         var query = new esri.tasks.Query();
         query.where = "1=1";
         featureLayer.queryFeatures(query, function(featureSet) {
          var features = featureSet.features;
          var min = max = parseFloat(features[0].attributes['sqldb27.SDE.afr_2010.publicSafety_e']);
          dojo.forEach(features, function(feature) {
            min = Math.min(min, feature.attributes['sqldb27.SDE.afr_2010.publicSafety_e']);
            max = Math.max(max, feature.attributes['sqldb27.SDE.afr_2010.publicSafety_e']);
          //divide the range of values by the number of classes to find the interval
          var numRanges = dijit.byId("breakLevel").get('displayedValue');
          var breaks = (max - min) / numRanges;
          var outline = new esri.symbol.SimpleLineSymbol().setWidth(1);
          var fillColor = new dojo.Color([240, 150, 240, 0.75]);
          var defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setSize(2).setOutline(outline);

          var renderer = new esri.renderer.ClassBreaksRenderer(defaultSymbol, 'sqldb27.SDE.afr_2010.publicSafety_e');

          //add the breaks using the interval calculated above
          for (var i = 0; i < numRanges; i++) {
            renderer.addBreak(parseFloat(min + (i * breaks)), parseFloat(min + ((i + 1) * breaks)), new esri.symbol.SimpleMarkerSymbol().setSize((i + 1) * 4).setColor(fillColor).setOutline(outline));