<?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: How I can Change the point color based on value from an array in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014211#M71290</link>
    <description>&lt;P&gt;Hi Abdul,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You need to use a uniqueValue renderer as explained here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jan 2021 09:16:13 GMT</pubDate>
    <dc:creator>shaylavi</dc:creator>
    <dc:date>2021-01-06T09:16:13Z</dc:date>
    <item>
      <title>How I can Change the point color based on value from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014190#M71289</link>
      <description>&lt;P&gt;Hi everyone ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to change my point color based on the value from an array&amp;nbsp;&lt;/P&gt;&lt;P&gt;the value named as (Temp) in the array .&lt;/P&gt;&lt;P&gt;Here is what I've did so far :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8"&amp;gt;
    &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"&amp;gt;
    &amp;lt;title&amp;gt;ArcGIS API for JavaScript Tutorials: Create a JavaScript starter app&amp;lt;/title&amp;gt;
    &amp;lt;style&amp;gt;
      html, body, #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
      
    &amp;lt;/style&amp;gt;
     &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.15/esri/themes/light/main.css"&amp;gt;
     &amp;lt;script src="https://js.arcgis.com/4.15/"&amp;gt;&amp;lt;/script&amp;gt;
     &amp;lt;script&amp;gt;

     // My Array
var locs =
[
  {
  "Id" : 1,
  "long": 46.738586,
  "lat": 24.774265 ,
  "Temp": 6
},
{
  "Id" : 2,
  "long": 48.738586,
  "lat": 26.774265 ,
  "Temp": 323
},
{
  "Id" : 3,
  "long": 50.738586,
  "lat": 28.774265 ,
  "Temp": 32
}
]


         require([
      "esri/Map",
      "esri/views/MapView",
      "esri/Graphic",
      "esri/layers/GraphicsLayer",
      "esri/geometry/Multipoint",
      "esri/layers/FeatureLayer",
  "esri/geometry/Point",
  "dojo/domReady!"
      
    ], function(Map, MapView, Graphic, GraphicsLayer, 
    Point) {
        
      
          var map = new Map({
            basemap: "dark-gray"
          });
      
          var view = new MapView({
            container: "viewDiv",
            map: map,
            center: [46.738586,24.774265], // longitude, latitude
            zoom: 6
          });

          
          
          var graphicsLayer = new GraphicsLayer();
       map.add(graphicsLayer);
       
      
         
          for (i = 0; i &amp;lt; locs.length; i++) {
           
            // create a point 
             var Point ={
              type: "point",
              longitude: locs[i].long,
               latitude: locs[i].lat,
               Temp: locs[i].Temp,
              ID : locs[i].Id,
             };
            if(Point.Temp == 6){
             var simpleMarkerSymbol = {
               type: "simple-marker",
               color: [255, 255, 255 ],  // Green
               outline: {
                 color: [255, 255, 255], // white
                 width: 1
               
              }
            }
          
             };

             //*** ADD ***//
            // Create attributes
            var attributes = {
              Name: "My point",  // The name of the
              Location: Point.ID,  // The owner of the
              Temp :  Point.Temp
            };
            // Create popup template
            var popupTemplate = {
              title: "{Name}",
              content: "Test &amp;lt;b&amp;gt;{Location}&amp;lt;/b&amp;gt; And &amp;lt;b&amp;gt;{Temp}&amp;lt;/b&amp;gt;"
            };

            var pointGraphic = new Graphic({
              geometry: Point,
              symbol: simpleMarkerSymbol,
              //*** ADD ***//
              attributes: attributes,
              popupTemplate: popupTemplate
            });

            graphicsLayer.add(pointGraphic);
          
          }
        });
        &amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 07:25:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014190#M71289</guid>
      <dc:creator>Abdulmajeed__</dc:creator>
      <dc:date>2021-01-06T07:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: How I can Change the point color based on value from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014211#M71290</link>
      <description>&lt;P&gt;Hi Abdul,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You need to use a uniqueValue renderer as explained here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 09:16:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014211#M71290</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-01-06T09:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: How I can Change the point color based on value from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014250#M71292</link>
      <description>&lt;P&gt;I didn't get it,&lt;/P&gt;&lt;P&gt;can you give me an example ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 13:25:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014250#M71292</guid>
      <dc:creator>Abdulmajeed__</dc:creator>
      <dc:date>2021-01-06T13:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: How I can Change the point color based on value from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014271#M71294</link>
      <description>&lt;P&gt;In your code, you create a Point, wrap it as a graphic and then add it into a graphic layer.&lt;/P&gt;&lt;P&gt;When creating a graphic you create a symbol definition to determine how the graphic looks like.&lt;/P&gt;&lt;P&gt;Renderers are a more advanced way to define how a group of symbols assigned to graphics/features based on different rules. There are different type of renderers such as scale-based/unique values/classes and more.&lt;/P&gt;&lt;P&gt;Instead of using a simple marker symbol that represents a single marker symbol, you should apply a renderer, which acts in a similar way to a marker symbol but with more advanced functionality, as described in the documentation for renderers.&lt;/P&gt;&lt;P&gt;Since you're using version 4.x of the API, I don't know if renderers can work on a graphic layer - it did work for version 3.x as described here: &lt;A href="https://developers.arcgis.com/javascript/3/jshelp/inside_renderers.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/3/jshelp/inside_renderers.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This link explain exactly all you need to know about markers and renderers. The concepts remain the same for both versions.&lt;/P&gt;&lt;P&gt;It could be that in version 4.x you cannot use renderers on graphics but I haven't tested it and it should be very easy to test - you just create a renderer and apply it as the symbol, as shown in the examples at the link above.&lt;/P&gt;&lt;P&gt;In case it doesn't work for graphics, you can convert the graphics to a feature layer of points and apply the renderer. The documentation is filled with examples on how to define a unique value renderer -&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;There's also a sandbox example for a renderer (defined on a feature layer and not a graphic layer) -&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=visualization-location-types" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=visualization-location-types&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Basically, a renderer is a collection of symbols based on some pre-defined rules.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 14:21:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1014271#M71294</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-01-06T14:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: How I can Change the point color based on value from an array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1028726#M71826</link>
      <description>&lt;P&gt;You can't use a renderer on a GraphicsLayer, &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html" target="_self"&gt;"&lt;/A&gt;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html" target="_self"&gt;Each graphic must have its own symbol since the GraphicsLayer cannot have an associated renderer"&lt;/A&gt;. That's a real bummer. It was a nice feature in 3.X.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 20:53:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-i-can-change-the-point-color-based-on-value/m-p/1028726#M71826</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2021-02-19T20:53:58Z</dc:date>
    </item>
  </channel>
</rss>

