Hi!
Does anybody have a working example of how to use the fromjson method on the esri/renderers/jsonUtils module?
Using the following code I expect a blue symbology to be applied but the blueRenderer object always ends up 'undefined'.
<SPAN class="keyword token">var</SPAN> featureLayer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">FeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices.arcgis.com%2FP3ePLMYs2RVChkJx%2Farcgis%2Frest%2Fservices%2FUSA_Counties%2FFeatureServer%2F0" target="_blank">https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Counties/FeatureServer/0</A><SPAN>"</SPAN></SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> rendererConfig <SPAN class="operator token">=</SPAN> <SPAN class="string token">'{"color"[0,112,255,64],"outline": {"color": [0,0,0,255],"width": 1,"type": "esriSLS","style": "esriSLSSolid","marker": null},"type": "esriSFS","style": "esriSFSSolid"}'</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> blueRenderer <SPAN class="operator token">=</SPAN> jsonUtils<SPAN class="punctuation token">.</SPAN><SPAN class="token function">fromJson</SPAN><SPAN class="punctuation token">(</SPAN>rendererConfig<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
featureLayer<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setRenderer</SPAN><SPAN class="punctuation token">(</SPAN>blueRenderer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
map<SPAN class="punctuation token">.</SPAN><SPAN class="token function">addLayer</SPAN><SPAN class="punctuation token">(</SPAN>featureLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Full code here - https://codepen.io/js_gsi/pen/prNvXJ.
Maybe my JSON is not well formed? I pulled it from this playground.
Thank you!
Jill