HOW TO
Polygon features can be displayed as color indexed, and the setOpacityInfo method can be used to set the opacity level of the rendered polygon. This method changes the transparency of the entire symbol, its outline and fill.
renderer.setOpacityInfo({ field:"STATE_NAME", stops:[ {value: 10, opacity:[value 0-1]}] }) ;In the script above, the transparency value can be set as a decimal value to get the desired transparency level of the polygon. 0 represents total transparency while 1 represents solid polygons. The following is an example of a working script that sets the opacity to 0.35 and a screenshot of the result.
Example: renderer.setOpacityInfo({ field:"STATE_NAME", stops:[ {value: 10, opacity:0.35}] }) ;
new SimpleFillSymbol( SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SHORTDASHDOTDOT, new Color([105, 105, 105]), 2 ), new Color([255, 255, 0, 0.25]) )In the above snippet, the SimpleFillSymbol.STYLE_NULL line sets no style on the polygon feature, giving the polygon layer only an outline. The RGBA constructor, new Color uses the RGB Decimal 105 for black, and 255 for white.
Get help from ArcGIS experts
Download the Esri Support App