<?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 UniqueValueRenderer with array of values in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640146#M59749</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is it possibile to create a UniqueValueRenderer using an array of values?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
var info = {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value: [1778,1779],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; symbol: new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([256,0,0]))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };

var renderer = new esri.renderer.UniqueValueRenderer(defaultSymbol, "O");
renderer.infos = [info];
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a layer with about 3000 polygons and I need to add tree type of symbols (red, yellow and green) based on a value coming from a database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. With ArcGis Dekstop this thing is possibile using the groups in the Unique Value Symbology.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marco&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Feb 2013 09:30:33 GMT</pubDate>
    <dc:creator>MarcoBrugna</dc:creator>
    <dc:date>2013-02-26T09:30:33Z</dc:date>
    <item>
      <title>UniqueValueRenderer with array of values</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640146#M59749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is it possibile to create a UniqueValueRenderer using an array of values?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
var info = {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value: [1778,1779],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; symbol: new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([256,0,0]))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };

var renderer = new esri.renderer.UniqueValueRenderer(defaultSymbol, "O");
renderer.infos = [info];
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a layer with about 3000 polygons and I need to add tree type of symbols (red, yellow and green) based on a value coming from a database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. With ArcGis Dekstop this thing is possibile using the groups in the Unique Value Symbology.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marco&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 09:30:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640146#M59749</guid>
      <dc:creator>MarcoBrugna</dc:creator>
      <dc:date>2013-02-26T09:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: UniqueValueRenderer with array of values</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640147#M59750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using an array instead a single string would be perfect for many solutions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please consider an implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 13:01:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640147#M59750</guid>
      <dc:creator>MartinOver</dc:creator>
      <dc:date>2015-03-27T13:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: UniqueValueRenderer with array of values</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640148#M59751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can accomplish this functionality using multiple calls to your renderer's addValue method in combination with passing a function into the UniqueValueRenderer constructor.&amp;nbsp; Check out this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: transparent; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 9pt; line-height: 12pt; white-space: pre;"&gt;r.addValue(3, greenSymbol);&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;renderer = new UniqueValueRenderer(defaultSymbol, function (value) {
&amp;nbsp; var expectedRedValue = 'red'; //You provide these based on your data
&amp;nbsp; var expectedYellowValue = 'yellow';
&amp;nbsp; var expectedGreenValue = 'green';
&amp;nbsp; if (value.attributes.YourAttribute == expectedRedValue) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;
&amp;nbsp; }
&amp;nbsp; else if (value.attributes.YourAttribute == expectedYellowValue) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 2;
&amp;nbsp; }
&amp;nbsp; else if (value.attributes.YourAttribute == expectedGreenValue) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 3;
&amp;nbsp; }
});


renderer.addValue(1, redSymbol);
renderer.addValue(2, yellowSymbol);
renderer.addValue(3, greenSymbol);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640148#M59751</guid>
      <dc:creator>ChristopherTotty</dc:creator>
      <dc:date>2021-12-12T03:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: UniqueValueRenderer with array of values</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640149#M59752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for this solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We would like to use the UniqueValueRenderer&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial','sans-serif';"&gt; inside the &lt;SPAN style="font-size: 11.0pt; font-family: 'Arial','sans-serif';"&gt;dynamicLayers parameter with a direkt browser request. The Request gets very long when the whole uniqueValueInfos part must be repeated for every single value.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial','sans-serif';"&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial','sans-serif';"&gt;Martin&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 14:11:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uniquevaluerenderer-with-array-of-values/m-p/640149#M59752</guid>
      <dc:creator>MartinOver</dc:creator>
      <dc:date>2015-03-27T14:11:39Z</dc:date>
    </item>
  </channel>
</rss>

