Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a feature layer used in a client flex application. The feature layer is used to publish a feature class that has many attributes. Among those attributes there is one named "color". As its name indicates, this attribute contains the color of the feature. This attribute (color) is meant to be modified by the user.

The symbology of the feature layer is set by a renderer created on the MXML file. I'd like to be able to set the color of each graphic of the feature layer, from its color attribute.

Is it possible to tell the mxml renderer to set the color of its symbol to the value contained in the color attribute? I'd like to do that on the mxml side without using ActionScript.

share|improve this question
add comment

1 Answer

For the featureLayer, you could use a UniqueValueRenderer based on the "color" attribute. You would have to predefine your list of color symbols ahead of time, and have the user pick from a list or dropdown of sorts. It's possible that you could let them define their own colors with an RGB picker, but that might be a lot of work.

This example shows a featureLayer with a ClassBreakRenderer, but you could easily switch it out for a UniqueValueRenderer based on your color palette of choice.

share|improve this answer
    
It's not UniqueValueRenderer that I need. I'd like to let the user choose any color he wants. With UniqueValueRenderer, that wouldn't be possible. I'm looking for something more like the "textAttribute" used in TextSymbol: <esri:TextSymbol placement="middle" textAttribute="NAME" /> Another option would be to create a custom Renderer component that I manipulate as I wannt. –  yo_haha Jun 14 '13 at 8:36
1  
As far as I know, there's not open-ended color renderer like that for the flex viewer. If you used the UniqueValueRenderer, you could modify it in the ActionScript to handle whatever colors are in the results. However, it may not be able to handle unknown color names such as Malachite or United Nations Blue –  raykendo Jun 14 '13 at 16:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.