Select to view content in your preferred language

Dynamic Renderers with custom colorRamps

2183
6
07-03-2012 09:49 AM
ErikMyers
Deactivated User
Does anyone know the format for the colorRamp array?  I am getting type conversion errors on the colorRamp. The 3.0 API documentation doesn't appear to specify the type for the items in the array.

I have:

  <esri:MultipartColorRamp id="colorRamp">
   <esri:colorRamps>
    <fx:Array>
     <fx:uint>0x5C8944</fx:uint>
     <fx:uint>0x89CD66</fx:uint>
     <fx:uint>0xF5CA7A</fx:uint>
     <fx:uint>0xE69800</fx:uint>
     <fx:uint>0xA87000</fx:uint>
    </fx:Array>
   </esri:colorRamps>
  </esri:MultipartColorRamp> 

Thanks!
Tags (2)
0 Kudos
6 Replies
DasaPaddock
Esri Regular Contributor
MultipartColorRamp.colorRamps should be an Array of AlgorithmicColorRamp instances.

See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/tasks/supportClasses/MultipartColor...
0 Kudos
JonBaier
Emerging Contributor
The documentation is not very clear on the ArcGIS Flex API side, The javascript documentation tells a bit more and we were able to get this working. However, the algorithmic color ramp seems to be changing the color when we try to make 5 solid colors. Compare this sample with the color page listed below.

        <esri:MultipartColorRamp id="colorRamp">

   <esri:colorRamps>

    <esri:AlgorithmicColorRamp fromColor="0x5C8944" toColor="0x5C8944"/>
    <esri:AlgorithmicColorRamp fromColor="0x89CD66" toColor="0x89CD66"/>
    <esri:AlgorithmicColorRamp fromColor="0xF5CA7A" toColor="0xF5CA7A"/>
    <esri:AlgorithmicColorRamp fromColor="0xE69800" toColor="0xE69800"/>
    <esri:AlgorithmicColorRamp fromColor="0xA87000" toColor="0xA87000"/>

   </esri:colorRamps>
 
</esri:MultipartColorRamp>

The forth color should look like this:

http://www.colorhexa.com/e69800
0 Kudos
JonBaier
Emerging Contributor
Sorry, looks like we had a rogue semi-transparent layer on top. Everything is working okay now.

Is there any plans to include a simpler class that doesn't require an algorithmic gradient for a solid color?

Thanks
0 Kudos
JonBaier
Emerging Contributor
Ok, so not completely out of the woods yet. If you use the color ramp listed above with the example here:

http://resources.arcgis.com/en/help/flex-api/samples/index.html#//01nq0000006z000000

You will see that the legend shows one more group then is specified in the color breaks (i.e. 9 breaks gives 10 results)

Is it possible to get a working example of using MultipartColorRamp with 5 solid predetermined colors?
0 Kudos
ErikMyers
Deactivated User
I'd just like to add a slight addition to Jon's comment in case you are having trouble replicating the problem.  You get 6 class breaks when the selector is set to 5.
0 Kudos
ErikMyers
Deactivated User
We are still having a problem getting the specified colors to render correctly in the application.  With this array of 5 algorithmicColorRamp instances and the number of class breaks set to 5, the first color (dark green) is displayed for both the first class and last class. The last color in the array (burnt orange) never renders and the first color in the array (dark green) is rendered twice (first and last).  This is occuring in both my application and the Generate Renderer sample code I copied from your flex API website.  Do you have any suggestions about how to fix this issue or update the array to work for the required application?

<esri:MultipartColorRamp id="colorRamp">
<esri:colorRamps>
  <!--dark green-->
  <esri:AlgorithmicColorRamp algorithm="esriCIELabAlgorithm" fromColor="0x5C8944" toColor="0x5C8944"/>
  <!--light green-->
  <esri:AlgorithmicColorRamp algorithm="esriCIELabAlgorithm" fromColor="0x89CD66" toColor="0x89CD66"/>
  <!--tan-->
  <esri:AlgorithmicColorRamp algorithm="esriCIELabAlgorithm" fromColor="0xF5CA7A" toColor="0xF5CA7A"/>
  <!--dark tan-->
  <esri:AlgorithmicColorRamp algorithm="esriCIELabAlgorithm" fromColor="0xE69800" toColor="0xE69800"/>
  <!--burnt orange-->
  <esri:AlgorithmicColorRamp algorithm="esriCIELabAlgorithm" fromColor="0xA87000" toColor="0xA87000"/>
   
</esri:colorRamps>
</esri:MultipartColorRamp>
0 Kudos