<?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 Change color of view graphic on click. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-color-of-view-graphic-on-click/m-p/1087721#M74242</link>
    <description>&lt;P&gt;I have an esri javascript map. I have an array of {lat, lng, id}.&amp;nbsp;&lt;SPAN&gt;I create a point with the lat, lng, and a symbol, then create a Graphic.&lt;/SPAN&gt; I add these items to the map using&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;esriView&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;add&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;pointGraphic&lt;/SPAN&gt;&lt;SPAN&gt;).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I click the graphic, (which is a small blue circle), I'd like to change the blue to red. However all that happens is I click the circle and my popupTemplate comes up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do I change the color of the selected graphic? I feel like this should be easy, but I can't find the answer anywhere.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Aug 2021 22:37:26 GMT</pubDate>
    <dc:creator>ScottAndersonGQ</dc:creator>
    <dc:date>2021-08-10T22:37:26Z</dc:date>
    <item>
      <title>Change color of view graphic on click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-color-of-view-graphic-on-click/m-p/1087721#M74242</link>
      <description>&lt;P&gt;I have an esri javascript map. I have an array of {lat, lng, id}.&amp;nbsp;&lt;SPAN&gt;I create a point with the lat, lng, and a symbol, then create a Graphic.&lt;/SPAN&gt; I add these items to the map using&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;esriView&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;add&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;pointGraphic&lt;/SPAN&gt;&lt;SPAN&gt;).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I click the graphic, (which is a small blue circle), I'd like to change the blue to red. However all that happens is I click the circle and my popupTemplate comes up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do I change the color of the selected graphic? I feel like this should be easy, but I can't find the answer anywhere.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 22:37:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-color-of-view-graphic-on-click/m-p/1087721#M74242</guid>
      <dc:creator>ScottAndersonGQ</dc:creator>
      <dc:date>2021-08-10T22:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change color of view graphic on click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-color-of-view-graphic-on-click/m-p/1087963#M74253</link>
      <description>&lt;P&gt;I've got this working with a polygon:&lt;BR /&gt;&lt;A href="https://codepen.io/cmenikheim-geojobe/pen/KKmJZPz?editors=1000" target="_blank"&gt;https://codepen.io/cmenikheim-geojobe/pen/KKmJZPz?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A point should function fairly similarly. You may want to put a small buffer around your point for listening to the map click - otherwise, the user would have to click the EXACT center of the graphic for this to work.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 15:49:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-color-of-view-graphic-on-click/m-p/1087963#M74253</guid>
      <dc:creator>CourtneyMenikheim</dc:creator>
      <dc:date>2021-08-11T15:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Change color of view graphic on click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-color-of-view-graphic-on-click/m-p/1088148#M74260</link>
      <description>&lt;P&gt;Thanks Courtney, that was helpful. I ended up designing a method that adds a new graphic on top of the old graphic on click.&lt;BR /&gt;Graphic is made with a popupTemplate that includes the "content" property. I set that to a function. See below.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;popupTemplate:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;...,&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; content:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;myFunction&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;}&lt;BR /&gt;On the graphic click it runs the function which cycles through all graphics and removes any with a specific style. myFunction(){&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;esriView&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;items&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;graphic&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//my regular graphics have a color.b of&amp;nbsp;&amp;nbsp;254. I don't want those ones. I want the selected ones which are different.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;graphic&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;symbol&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;color&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;b&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;!=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;254&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;});&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;//should only be one in the array, but just in case another selected graphic got in there.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;esriView&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;removeMany&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;graphics&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;//add&amp;nbsp;a&amp;nbsp;new&amp;nbsp;graphic&amp;nbsp;to&amp;nbsp;map&amp;nbsp;with&amp;nbsp;different color&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;myFunction2(newgraphicWithTheSameLocationAndAttributes, ThisTimeWithANewColor)&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Hope that helps.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 Aug 2021 21:01:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-color-of-view-graphic-on-click/m-p/1088148#M74260</guid>
      <dc:creator>ScottAndersonGQ</dc:creator>
      <dc:date>2021-08-11T21:01:42Z</dc:date>
    </item>
  </channel>
</rss>

