> By extrapolation, would PieSeries also accept an array of gradients
intead of an array of hex values? 

Yes. The fill property of most series, and the fills property of the
pieSeries, take Fill objects. Which means any of them can take solid fills,
solid fills with alpha, linear gradients, and radial gradients. The same is
true for the pointFill property of line series and area series, the fill
property of the charts (which specifies the background color), and the
various *fill properties of the GridLines class.

>And is there a way to represent this in css?  

Unfortunately, no, that's a limitation of CSS.  We're considering whether
and how to address this in the next release of flex, but for the meantime,
you can:

- specify the styles inline on the item in MXML
- set the values on the CSSStyleDeclaration for PieSeries at initialization
through actionscript
- write a subclass of PieSeries that sets its fill style in its constructor,
and use that instead
- write a custom MXML component that allows you to specify CSS data using 
MXML.

Let me explain that last one a bit.  A while back I wrote up a little
actionscript class that allowed me to specify CSS properties using MXML.
I've included it at the bottom of this email, for your enjoyment and/or use.
But a small caveat -- when you specify styles via CSS, the compiler is able
to optimize assigning the styles a little bit better than this class can. So
using this class might have an effect on your startup time.  You'll have to
try it out yourself, and decided if the benefits outweigh the cost.


> Also would it be possible to alter the styleName property of a
PieSeries at runtime?


Yes, absolutely. PieChart.series[0].styleName = "...";

In my earlier response, I fibbed a little bit.  I said that the chart object
assigns the styleName of each series on the fly. In truth, it's not actually
assigning the styleName -- it's really assigning a different internal
property of the series, that inserts style properties into the style chain
at a slightly lower priority than the styleName property does. What does
this mean? Well, if you assign the styleName property, you'll override any
style properties you want to override, without accidentally blowing away the
ones you want to keep the same.


Ely.
-------------------------
style/Selector.as:

import mx.util.*;
import mx.core.*;
import mx.styles.*;


/*
        Here's an example of how you might use this class in an MXML file:
        <style:Selector name=".Creamsicle" xmlns:style="style.*">
                <fills>
                        <mx:Array>
                                <mx:SolidColor color="#E48801" />
                                <mx:SolidColor color="#E5A53B" />
                                <mx:SolidColor color="#E7C274" />
                                <mx:SolidColor color="#E9D9A6" />
                                <mx:SolidColor color="#EDE9C6" />
                        </mx:Array>
                </fills>
                <font-family>labelFont</font-family>
                <font-weight>bold</font-weight>
                <font-size>24</font-size>
        </style:Selector>
*/

dynamic class style.Selector implements MXMLObject 
{
        
        public var name:String;
        
    public function initialized(document : Object, id : String) : Void
    {
                var selectorName = name;

                if(selectorName.indexOf(".") == 0)
                        selectorName = selectorName.substr(1);
                
                var selector:CSSStyleDeclaration =
StyleManager.styles[selectorName];
                if(selector == null)
                         selector = StyleManager.styles[selectorName] = new
CSSStyleDeclaration();

                for(var aProp in this) {
                        if(aProp == "name")
                                continue;
                        selector.setStyle(removeDashes(aProp),this[aProp]);
                }
                
        }
        public function removeDashes(oldName:String):String
        {
                var name:String = oldName;
                var idx:Number = name.indexOf("-");
                while(idx != -1) {
                        name = name.substr(0,idx) +
name.substr(idx+1,1).toUpperCase() + name.substr(idx+2);
                        idx = name.indexOf("-");
                }
                return name;
        }               
}


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to