Select to view content in your preferred language

SimplelineSymbol with line border

1583
2
04-05-2019 02:27 PM
IanLouw
New Contributor II

I have created one query layer map by consuming featurelayerserver service URL in JavaScript API 4.10. Where I have some poly lines and I have added the graphics to display the lines in green color.And now I need to give a border in black color to that yellow line. Can anyone help me by giving the direction how to achieve that in JavaScript API 4.10 query graphics layer. My sample code is as below -

        queryTask.execute(querygreen).then(function(result) {
          //console.log(result.features.length)
          result.features.forEach(function(item) {
            var green = new Graphic({
              geometry: item.geometry,
              attributes: item.attributes,
              symbol: {
                type: "simple-line",
                color: "#417505",
                width: 2
              }
            });
            view.graphics.add(green);
          });

          // Zoom to the features
          view.goTo({
            target: view.graphics
          });
        });

Can anyone please help me ..

0 Kudos
2 Replies
GregoryBologna
Occasional Contributor II

Perhaps Outline is what you're looking for? 

https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html

Paste a mock up of what you want to achieve.

0 Kudos
FC_Basson
MVP Regular Contributor

In version 3.X of the API you could specify the outline colour seperately from the inner colour, but I the 4.X LineSymbol does not have that property.  You might need to add an additional black line graphic for each feature with an bigger width before adding the yellow line graphic.

0 Kudos