<?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 Combining legend and visibility slider in to the layer list in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-legend-and-visibility-slider-in-to-the/m-p/1239234#M79604</link>
    <description>&lt;P&gt;I am looking for the combination of Legend and Visibility Slider both in to the Layer List.&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;const&lt;/SPAN&gt; layerList = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;LayerList&lt;/SPAN&gt;({
  &lt;SPAN class=""&gt;view&lt;/SPAN&gt;: view,
  &lt;SPAN class=""&gt;listItemCreatedFunction&lt;/SPAN&gt;: &lt;SPAN class=""&gt;function&lt;/SPAN&gt; (&lt;SPAN class=""&gt;event&lt;/SPAN&gt;) {
    &lt;SPAN class=""&gt;const&lt;/SPAN&gt; item = event.&lt;SPAN class=""&gt;item&lt;/SPAN&gt;;
    item.&lt;SPAN class=""&gt;panel&lt;/SPAN&gt; = {
      &lt;SPAN class=""&gt;content&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"legend"&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;open&lt;/SPAN&gt;: &lt;SPAN class=""&gt;true&lt;/SPAN&gt;
    };

 &lt;SPAN class=""&gt;const&lt;/SPAN&gt; slider = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;Slider&lt;/SPAN&gt;({
      &lt;SPAN class=""&gt;min&lt;/SPAN&gt;: &lt;SPAN class=""&gt;0&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;max&lt;/SPAN&gt;: &lt;SPAN class=""&gt;1&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;precision&lt;/SPAN&gt;: &lt;SPAN class=""&gt;2&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;values&lt;/SPAN&gt;: [ &lt;SPAN class=""&gt;1&lt;/SPAN&gt; ],
      &lt;SPAN class=""&gt;visibleElements&lt;/SPAN&gt;: {
        &lt;SPAN class=""&gt;labels&lt;/SPAN&gt;: &lt;SPAN class=""&gt;true&lt;/SPAN&gt;,
        &lt;SPAN class=""&gt;rangeLabels&lt;/SPAN&gt;: &lt;SPAN class=""&gt;true&lt;/SPAN&gt;
      }
    });

    item.&lt;SPAN class=""&gt;panel&lt;/SPAN&gt; = {
      &lt;SPAN class=""&gt;content&lt;/SPAN&gt;: slider,
      &lt;SPAN class=""&gt;className&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"esri-icon-sliders-horizontal"&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;title&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"Change layer opacity"&lt;/SPAN&gt;
    };
  }
});&lt;/PRE&gt;&lt;P&gt;Is it possible? if yes, Please share the code.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2022 17:25:37 GMT</pubDate>
    <dc:creator>rajriyas9</dc:creator>
    <dc:date>2022-12-08T17:25:37Z</dc:date>
    <item>
      <title>Combining legend and visibility slider in to the layer list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-legend-and-visibility-slider-in-to-the/m-p/1239234#M79604</link>
      <description>&lt;P&gt;I am looking for the combination of Legend and Visibility Slider both in to the Layer List.&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;const&lt;/SPAN&gt; layerList = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;LayerList&lt;/SPAN&gt;({
  &lt;SPAN class=""&gt;view&lt;/SPAN&gt;: view,
  &lt;SPAN class=""&gt;listItemCreatedFunction&lt;/SPAN&gt;: &lt;SPAN class=""&gt;function&lt;/SPAN&gt; (&lt;SPAN class=""&gt;event&lt;/SPAN&gt;) {
    &lt;SPAN class=""&gt;const&lt;/SPAN&gt; item = event.&lt;SPAN class=""&gt;item&lt;/SPAN&gt;;
    item.&lt;SPAN class=""&gt;panel&lt;/SPAN&gt; = {
      &lt;SPAN class=""&gt;content&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"legend"&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;open&lt;/SPAN&gt;: &lt;SPAN class=""&gt;true&lt;/SPAN&gt;
    };

 &lt;SPAN class=""&gt;const&lt;/SPAN&gt; slider = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;Slider&lt;/SPAN&gt;({
      &lt;SPAN class=""&gt;min&lt;/SPAN&gt;: &lt;SPAN class=""&gt;0&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;max&lt;/SPAN&gt;: &lt;SPAN class=""&gt;1&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;precision&lt;/SPAN&gt;: &lt;SPAN class=""&gt;2&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;values&lt;/SPAN&gt;: [ &lt;SPAN class=""&gt;1&lt;/SPAN&gt; ],
      &lt;SPAN class=""&gt;visibleElements&lt;/SPAN&gt;: {
        &lt;SPAN class=""&gt;labels&lt;/SPAN&gt;: &lt;SPAN class=""&gt;true&lt;/SPAN&gt;,
        &lt;SPAN class=""&gt;rangeLabels&lt;/SPAN&gt;: &lt;SPAN class=""&gt;true&lt;/SPAN&gt;
      }
    });

    item.&lt;SPAN class=""&gt;panel&lt;/SPAN&gt; = {
      &lt;SPAN class=""&gt;content&lt;/SPAN&gt;: slider,
      &lt;SPAN class=""&gt;className&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"esri-icon-sliders-horizontal"&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;title&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"Change layer opacity"&lt;/SPAN&gt;
    };
  }
});&lt;/PRE&gt;&lt;P&gt;Is it possible? if yes, Please share the code.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 17:25:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-legend-and-visibility-slider-in-to-the/m-p/1239234#M79604</guid>
      <dc:creator>rajriyas9</dc:creator>
      <dc:date>2022-12-08T17:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Combining legend and visibility slider in to the layer list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-legend-and-visibility-slider-in-to-the/m-p/1240694#M79638</link>
      <description>&lt;P&gt;This simple codepen show how this can be done:&amp;nbsp;&lt;A href="https://codepen.io/U_B_U/pen/VwdJbBe?editors=100" target="_blank"&gt;https://codepen.io/U_B_U/pen/VwdJbBe?editors=100&lt;/A&gt;&amp;nbsp;and the below is the main code:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; const itemPanelDiv = document.createElement("div");

 const sliderDiv = document.createElement("div");
 sliderDiv.classList.add("esri-widget");
 const slider = new Slider({
   min: 0,
   max: 1,
   precision: 2,
   values: [1],
   visibleElements: {
     labels: true,
     rangeLabels: true
   },
   container: sliderDiv
 });

slider.on("thumb-drag", (event) =&amp;gt; {
  const { value } = event;
  item.layer.opacity = value;
});

const legendDiv = document.createElement("div");
legendDiv.classList.add("esri-widget");
const legend = new Legend({
  view: view,
  layerInfos: [
    {
      layer: item.layer
    }
   ],
   container: legendDiv
});
itemPanelDiv.append(sliderDiv, legendDiv);

item.panel = {
  content: itemPanelDiv,
  className: "esri-icon-collection",
  open: true, //item.visible,
  title: "title"
};&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Dec 2022 17:57:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-legend-and-visibility-slider-in-to-the/m-p/1240694#M79638</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-12-13T17:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining legend and visibility slider in to the layer list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-legend-and-visibility-slider-in-to-the/m-p/1321675#M82069</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/53756"&gt;@UndralBatsukh&lt;/a&gt;! That covered all the little pieces I was missing.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 15:18:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-legend-and-visibility-slider-in-to-the/m-p/1321675#M82069</guid>
      <dc:creator>Jeff-Reinhart</dc:creator>
      <dc:date>2023-08-23T15:18:45Z</dc:date>
    </item>
  </channel>
</rss>

