<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why is my legend not showing up? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-legend-not-showing-up/m-p/208582#M19354</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In your application you are adding the legend when the map's onLayersAddResult event is fired. This event only happens if layers are added to the map using map.addLayers(). In your code you are using map.addLayer. If you modify the line that adds the layer to read as follows your legend will appear. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayers([dynamicLayer]);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 10:18:08 GMT</pubDate>
    <dc:creator>KellyHutchins</dc:creator>
    <dc:date>2021-12-11T10:18:08Z</dc:date>
    <item>
      <title>Why is my legend not showing up?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-legend-not-showing-up/m-p/208581#M19353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have added some code to my page to display a legend in a div element. I have placed the div element on the page but for some reason the legend is not showing up. There appears to be no error message in the Javascript tools (Google Chrome browser). The code for the legend is simply a copy-paste from the samples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//add the legend
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(map,'onLayersAddResult',function(results){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //add the legend 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var legend = new esri.dijit.Legend({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map:map,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerInfos:[{layer:dynamicLayer,title:"Legend"}],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arrangement:esri.dijit.Legend.ALIGN_RIGHT
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },"legendDiv");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; legend.startup();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the page itself:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://northmiamicra.org/PWorksLayoutdynamic.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://northmiamicra.org/PWorksLayoutdynamic.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-legend-not-showing-up/m-p/208581#M19353</guid>
      <dc:creator>GarethMann</dc:creator>
      <dc:date>2021-12-11T10:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my legend not showing up?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-legend-not-showing-up/m-p/208582#M19354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In your application you are adding the legend when the map's onLayersAddResult event is fired. This event only happens if layers are added to the map using map.addLayers(). In your code you are using map.addLayer. If you modify the line that adds the layer to read as follows your legend will appear. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayers([dynamicLayer]);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:18:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-legend-not-showing-up/m-p/208582#M19354</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2021-12-11T10:18:08Z</dc:date>
    </item>
  </channel>
</rss>

