AnsweredAssumed Answered

Symbol for Graphic object is always undefined when added to layer

Question asked by svametcalf on Mar 18, 2015
Latest reply on Mar 18, 2015 by khutchins-esristaff

When accessing a Graphic object, the Symbol attribute returns undefined, even though a symbol is drawn on the map. After changing the symbol using the graphic.setSymbol() method, it is no longer undefined. Here is slightly modified code from this sample for a CSV layer:


<!DOCTYPE html>
    <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="">
      html, body, #map {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
      body {
        background-color: #FFF;
        overflow: hidden;
        font-family: "Trebuchet MS";
    <script src=""></script>
      var map, csv;

      ], function(
        Map, CSVLayer, Color, SimpleMarkerSymbol, SimpleRenderer, InfoTemplate, urlUtils, on
      ) {
          proxyUrl: "/proxy/",
          urlPrefix: ""
        map = new Map("map", {
          basemap: "gray",
          center: [ -60, -10 ],
          zoom: 4 
        csv = new CSVLayer("", {
          copyright: ""
        var orangeRed = new Color([238, 69, 0, 0.5]); // hex is #ff4500
        var marker = new SimpleMarkerSymbol("solid", 15, null, orangeRed);
        var renderer = new SimpleRenderer(marker);
        var template = new InfoTemplate("${type}", "${place}");

        on(map.getLayer(map.graphicsLayerIds[0]), 'click', function(event){
          console.log("Before Changing: ", event.graphic.symbol)
          event.graphic.setSymbol(new SimpleMarkerSymbol("solid", 30, null, new Color([238, 69, 0, 0.5])))
          console.log("After changing: ", event.graphic.symbol)

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


Am I doing something dumb, or is this a bug? I would like to access the symbol for a given graphic before a user interacts with it