Item Renderer is a style. so you have to do this:
 
 
ps.setStyle("itemRenderer", ... );
 
 
What do you pass in as the value?
 
1) Passing null doesn't work. You've overridden the style, so you need ot set a new value.  The default value is the class mx.charts.renderers.WedgeItemRenderer.
 
2) itemRenderers are typed as IFactory. Meaning they need to be an object that implements the IFactory interface.  Flex ships with a default IFactory that simply wraps a class, called ClassFactory.
So you want to do this:
 
import mx.charts.renderers.WedgeItemRenderer;
 
ps.setStyle("itemRenderer", new ClassFactory(WedgeItemRenderer));
 
you'll probably have to import ClassFactory too...I don't remember what it's package is (probably mx.core), but you can find it in the AS doc reference.
 
Ely.
 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jason
Sent: Friday, June 16, 2006 4:19 PM
To: [email protected]
Subject: [flexcoders] changing out pieSeries.itemRenderer at runtime

Okay, so I've made an itemRenderer for a pieSeries.  But sometimes I want to turn it off.  How might I go about that?

    <mx:PieSeries id="ps" field="time" labelPosition="insideWithCallout" labelFunction="getLabel"
      dataProvider="{chartData}" insideLabelSizeLimit="10" fontSize="10">
          <mx:itemRenderer>
              <mx:Component>
                  <nes:PieCategoryWedgeRenderer>
                      <nes:categories>
                          <nes:PieCategory va! lue="Encouraged" color="#99FF99"/>
                          <nes:PieCategory value="Acceptable" color="#9999FF"/>
                          <nes:PieCategory value="Risk" color="#FFFF99"/>
                          <nes:PieCategory value="High Risk" color="#FF9999"/>
                      </nes:categories>
                  </nes:PieCategoryWedgeRenderer>
              </mx:Component>
          </mx:itemRen! derer>
    </mx:PieSeries>


< /font>PieCategoryWedgeRenderer is a class I wrote that I mentioned in another thread.  So now in some function in the application, I want to say:

ps.itemRenderer = null;

or even

ps.itemRenderer.categories[0].value = "NewTitle";

I've read through all the help and can't figure out how I would actually do that.  FB says it has no idea what "ps.itemRenderer" is referring to.  So that kinda stumps me.

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to