rebeccarothbard1

Unable to see service in renderer application using JS API

Discussion created by rebeccarothbard1 on Apr 19, 2012
I used this code (http://help.arcgis.com/en/webapi/javascript/arcgis/demos/renderer/renderer_class_breaks.html) as the basis/example for my code (below) in which I attempt to render my service based on 4 variable choices each 5 class breaks. For some reason, I cant see the service or engage the radio buttons used to fire/select the renderer (look under the visualize tab).

When I use firebug to debug, I get the this: dojo.io.script.jsonp_dojoIoScript_ArcSDEDatabase_RROTHBARD_all_pblshd_prj_04111203 is undefined.

Code snippet:

var map;
   var featureLayerlngpn, featureLayershrtpn, featureLayerrstrnt, featureLayerhrpu;
function init() {
        esri.config.defaults.map.sliderLabel = null;
        var initExtent = new esri.geometry.Extent({"xmin":-13968548.1620506,"ymin":2657852.19132631,"xmax":-7443191.79718263,"ymax":6583247.6870947,"spatialReference":{"wkid":102100}});
        map = new esri.Map("map",{ extent: initExtent});
       
        dojo.connect(map, "onLoad", initOperationalLayer);
        map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
}
      function initOperationalLayer() {
       var symbol = new esri.symbol.SimpleFillSymbol();
       symbol.setColor(new dojo.Color([150, 150, 150, 1]));
   
<!--Establish lngpn Renderer, lngpn Layer, lngpn InfoWindow-->
      
       var rendererlngpn = new esri.renderer.ClassBreaksRenderer(symbol, "lngpn");
       rendererlngpn.addBreak(0, 0, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([56, 168, 0, 1])));
       rendererlngpn.addBreak(0.1, 2.6, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([139, 209, 0, 1])));
       rendererlngpn.addBreak(2.7, 4.1, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 255, 0, 1])));
       rendererlngpn.addBreak(4.2, 5.7, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 128, 0, 1])));
       rendererlngpn.addBreak(5.8, 8.6, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 0, 0, 1])));
       
   
      var infoTemplate = new esri.InfoTemplate("${STATE_NAME}", "${*}");
     
    featureLayerlngpn = new esri.layers.FeatureLayer("http://209.197.249.119/ArcGIS/rest/services/all_statemeasures_041112/MapServer/0", {
          mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
          outFields: ["*"],
          infoTemplate: infoTemplate,
          opacity: .25
        });
      
        featureLayerlngpn.setRenderer(new esri.renderer.ClassBreaksRenderer(symbol));<!--not sure if I should name renderer or use new esri.renderer name-->
        map.addLayer(featureLayerlngpn);
  featureLayerlngpn.visible = true
 
<!--Establish shrtpn Renderer, shrtpn Layer, shrtpn InfoWindow-->
        var renderershrtpn = new esri.renderer.ClassBreaksRenderer(symbol, "shrtpn");
        renderershrtpn.addBreak(10.7, 15.1, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([56, 168, 0, 1])));
        renderershrtpn.addBreak(15.2, 18.2, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([139, 209, 0, 1])));
        renderershrtpn.addBreak(18.3, 21.6, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 255, 0, 1])));
        renderershrtpn.addBreak(21.7, 26.8, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 128, 0, 1])));
        renderershrtpn.addBreak(26.9, 39, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 0, 0, 1])));
   
     var infoTemplate = new esri.InfoTemplate("${STATE_NAME}", "${*}");
     
   featureLayershrtpn = new esri.layers.FeatureLayer("http://209.197.249.119/ArcGIS/rest/services/all_statemeasures_041112/MapServer/0", {
          mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
          outFields: ["*"],
          infoTemplate: infoTemplate,
          opacity: .25
        });
      
        featureLayershrtpn.setRenderer(renderershrtpn);<!--this may not be correct-->
        map.addLayer(featureLayershrtpn);
  featureLayershrtpn.visible = false
 
<!--Establish rstrnt Renderer, rstrnt Layer, rstrnt InfoWindow-->
    var rendererrstrnt = new esri.renderer.ClassBreaksRenderer(symbol, "rstrnt");
       rendererrstrnt.addBreak(0, 0, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([56, 168, 0, 1])));
       rendererrstrnt.addBreak(.1, 2, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([139, 209, 0, 1])));
       rendererrstrnt.addBreak(2.1, 2.9, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 255, 0, 1])));
       rendererrstrnt.addBreak(3, 4.1, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 128, 0, 1])));
       rendererrstrnt.addBreak(4.2, 6.1, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 0, 0, 1])));
   
var infoTemplate = new esri.InfoTemplate("${STATE_NAME}", "${*}");
     
   featureLayerrstrnt = new esri.layers.FeatureLayer("http://209.197.249.119/ArcGIS/rest/services/all_statemeasures_041112/MapServer/0", {
          mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
          outFields: ["*"],
          infoTemplate: infoTemplate,
          opacity: .25
        });
      
        featureLayerrstrnt.setRenderer(rendererrstrnt);
        map.addLayer(featureLayerrstrnt);
     featureLayerrstrnt.visible = false;
    
<!--Establish hrpu Renderer, hrpu Layer, hrpu InfoWindow-->
    var rendererhrpu = new esri.renderer.ClassBreaksRenderer(symbol, "hrpu");
       rendererhrpu.addBreak(0, 0, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([56, 168, 0, 1])));
       rendererhrpu.addBreak(.1, 7.6, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([139, 209, 0, 1])));
       rendererhrpu.addBreak(7.7, 9.3, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 255, 0, 1])));
       rendererhrpu.addBreak(9.4, 10.8, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 128, 0, 1])));
       rendererhrpu.addBreak(10.9, 14.6, new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255, 0, 0, 1])));
   
     var infoTemplate = new esri.InfoTemplate("${STATE_NAME}", "${*}");
     
   featureLayerhrpu = new esri.layers.FeatureLayer("http://209.197.249.119/ArcGIS/rest/services/all_statemeasures_041112/MapServer/0", {
          mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
          outFields: ["*"],
          infoTemplate: infoTemplate,
          opacity: .25
        });
      
        featureLayerhrpu.setRenderer(rendererhrpu);
        map.addLayer(featureLayerhrpu);
     featureLayerhrpu.visible = false;
    
      }
  
function showlngpn(){
   
  //map.removeAllLayers();
  //map.removeLayer(featureLayershrtpn);
  //map.removeLayer(featureLayerrstrnt);
  //map.removeLayer(featureLayerhrpu);
  map.addLayer(featureLayerlngpn);
  featureLayerlngpn.visible = true;

}

function showshrtpn(){

  //map.removeAllLayers();
  //map.removeLayer(featureLayerlngpn);
  //map.removeLayer(featureLayerrstrnt);
  //map.removeLayer(featureLayerhrpu);
  map.addLayer(featureLayershrtpn);
  featureLayershrtpn.visible = true;
}
function showrstrnt(){

  //map.removeAllLayers();
 
  //map.removeLayer(featureLayerlngpn);
  //map.removeLayer(featureLayershrtpn);
  //map.removeLayer(featureLayerhrpu);
  map.addLayer(featureLayerrstrnt);
  featureLayerrstrnt.visible = true;
}
     
function showhrpu(){

  //map.removeAllLayers();
 
  //map.removeLayer(featureLayerlngpn);
  //map.removeLayer(featureLayershrtpn);
  //map.removeLayer(featureLayerrstrnt);
  map.addLayer(featureLayerhrpu);
  featureLayerhrpu.visible = true;
}     
      dojo.addOnLoad(init);

Thanks in advance for any help,
Rebecca

Outcomes