I have multiple featureLayers and one graphicLayer for adding graphics. However I cannot add a graphic to this layer. Can someone help with what I'm doing wrong ?

featureLayer.on("click", function (evt) {
  attrs = evt.graphic.attributes;
  if(clickmode == 1) {
    var highlightSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255, 0, 0]));
    var location = new Point(evt.mapPoint.x, evt.mapPoint.y, evt.spatialReference);
    graphicLayer.add(new Graphic(location, highlightSymbol));
  • Where is clickmode being set?
    – kenbuja
    Mar 8, 2017 at 1:05

1 Answer 1


it looks like you've created an empty symbol. you should try specify a shape and size. i would suggest you use the AMD module require "esri/symbols/SimpleMarkerSymbol" :

var highlightSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, '', new Color([255, 0, 0]));

also, maybe you could even make a new graphic, without cerating a new Point, just by using evt.mapPoint, which is already a Point :

graphicLayer.add(new Graphic(evt.mapPoint, highlightSymbol));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.