AnsweredAssumed Answered

Label on polyline mid point

Question asked by fran_ferg on Sep 23, 2014
Latest reply on Sep 23, 2014 by fran_ferg

Dear all,


I am trying to put a label(TextSymbol) at a polyline midpoint (graphics layer). This is my code so far:


            var startX = coorX[0];             var endX = coorX[coorX.length - 1];                         var midPointX = ((endX - startX) / 2).toFixed(2);              var startY = coorY[0];             var endY = coorY[coorY.length - 1];             var midPointY = ((endY - startY) / 2).toFixed(2);              var font = new Font("12px", Font.STYLE_NORMAL, Font.STYLE_NULL, Font.VARIANT_NORMAL, Font.WEIGHT_NULL, "Arial");                          var pipePoint = new Point(midPointX, midPointY, map.spatialReference);              // create a text symbol             var textSymbol = new TextSymbol("LABEL TEXT!!!", font, new Color([0, 0, 0]));              var labelGraphic = new Graphic(pipePoint, textSymbol);              // add the label point graphic to the map   ;


Can't see the label anywhere. I tried to increase the font size but with no success. I'd appreciate some help.


Thanks in advance.