PW941248

Dot Density Renderer Drawing Problem

Discussion created by PW941248 on Jun 9, 2014
Hi All:

Attached is some code I'm working on, it is fairly simplistic, basically I just want to bring in a polygon file and using a dot density renderer display dots based on a field from that polygon layer. It looks like the renderer works, in the sense that the dots are created according to firebug, but the dots fail to display on the map. I must be missing something simple so I was wondering if someone here can give it a fresh set of eyes and let me know what I'm missing.

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Simple Map</title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
    <style>
      html, body, #map {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
      }
      body {
        background-color: #FFF;
        overflow: hidden;
        font-family: "Trebuchet MS";
      }
    </style>
    <script src="http://js.arcgis.com/3.9/"></script>
    <script>
      var map;

      require(["esri/map","esri/renderers/DotDensityRenderer", "esri/layers/FeatureLayer", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/renderers/SimpleRenderer","esri/InfoTemplate",
      "esri/graphic","dojo/on","dojo/_base/Color", "esri/layers/ArcGISDynamicMapServiceLayer","dojo/domReady!"],
      function(Map,DotDensityRenderer,FeatureLayer, SimpleFillSymbol, SimpleLineSymbol, SimpleRenderer, InfoTemplate, Graphic,on, Color,ArcGISDynamicMapServiceLayer)
      {
        map = new Map("map", {
          basemap: "streets",
          center: [-75.45, 42.75], // longitude, latitude
          zoom: 7
        });
        
      
      
        var schoolDistricts = new FeatureLayer ("http://w7hp348/arcgis/rest/services/Testservice/MergedDistricts/FeatureServer/0",{
            mode: FeatureLayer.MODE_SNAPSHOT,
            outfields:["TOTALENROLLMENT"]
          });
          schoolDistricts.setDefinitionExpression("TOTALENROLLMENT>1");
          
              
         var dotDensityRenderer = new DotDensityRenderer({
          fields: [{
          name: "TOTALENROLLMENT",
          color: new Color([52, 114, 53])
                  }],
          dotValue: 1,
          dotSize: 5
                  });
          schoolDistricts.setRenderer(dotDensityRenderer); 
          console.log(schoolDistricts);
          
         map.addLayer(schoolDistricts);
        
      });
      

    </script>
  </head>

  <body>
    <div id="map"></div>
  </body>
</html>

Outcomes