AnsweredAssumed Answered

How To Render Layer By Unique Value Without Hard Coding the Values

Question asked by danx on Dec 7, 2012
Latest reply on Dec 11, 2012 by danx
Javascript API 3.2  ArcGIS Server 10.1


I am new to the Javascript API (JSAPI), and am trying not to get bogged down with what should be very basic and easy by now.  But, nonetheless, here I am . . .

I would like to symbolize selected features in a polygon layer by unique value without hard-coding all of the values.

I also want to be sure that the colors are as distinguishable as possible depending on the quantity of unique values (in other words, not render 15 values in 15 shades of green, but render via an algorithm that does a better job than just random color generation).

The only unique-value renderer example I could find for JSAPI was here -----  ----- but it only shows how to do this by hard-coding each value.

I've been searching the web for a solution, but found none as of yet.  I've also been banging my head with ESRI support, but the answer I finally got was that there is no such thing as an ESRI unique value renderer for JSAPI and that I will have to hard code all of the values manually and write a bunch of Javascript to sort out any duplicates.  That just doesn't seem reasonable to me since rendering a selected set of polygons by unique value is fundamental GIS - basic thematic mapping that we've been doing for many years.

I just know there are many out there doing this successfully.  Any guidance would be appreciated.