Ely,
Okay, I admit, the subject is a LITTLE misleading. Your
original page for the stoplight renderer (http://www.quietlyscheming.com/blog/charts/data-based-renderers/
) does still work. But a slight derivative of it now seems to
fail.
I'm specifically referring to setting the itemRenderer at
runtime. Using setStyle("itemRenderer", ...), the chart never seems to
update. Below is my example based on your example. I show three
charts. The first is using a switchable item renderer, the second is using
MyStoplightItemRenderer, the third using MyStoplightItemRenderer2. The
radio button is supposed to switch the first chart back and forth these
two. This used to work under the beta. Now it seems to have no
effect.
Can you confirm this is a bug in Flex? I'm not going to
post it to the bug webpage yet in case you just changed how you are supposed to
approach this problem.
Stoplight.mxml:
<?xml version="1.0"
encoding="utf-8"?>
<Application xmlns="http://www.adobe.com/2006/mxml"
layout="absolute">
<Script>
<![CDATA[
public
function changeRenderer(e:Event):void {
switch (rendergroup.selectedValue) {
case "Renderer1":
pie.setStyle('itemRenderer', new ClassFactory(MyStoplightWedgeRenderer));
break;
case "Renderer2":
pie.setStyle('itemRenderer', new ClassFactory(MyStoplightWedgeRenderer2));
break;
}
}
]]>
</Script>
<XML
id="dataSet" source="data/sampleData.xml" />
<Panel
width="100%" height="100%" title="data based renderers" >
<RadioButtonGroup id="rendergroup"
change="changeRenderer(event)"/>
<RadioButton label="Renderer1" groupName="rendergroup"/>
<RadioButton label="Renderer2" groupName="rendergroup"/>
<PieChart id="chart" width="100%" height="100%" dataProvider="{dataSet.Sample
}">
<series>
<PieSeries field="@costs" id="pie"/>
</series>
</PieChart>
<PieChart id="chart2" width="100%" height="100%" dataProvider="{
dataSet.Sample}">
<series>
<PieSeries field="@costs" id="pie2"
itemRenderer="MyStoplightWedgeRenderer"/>
</series>
</PieChart>
<PieChart id="chart3" width="100%" height="100%"
dataProvider="{dataSet.Sample}">
<series>
<PieSeries field="@costs" id="pie3"
itemRenderer="MyStoplightWedgeRenderer2"/>
</series>
</PieChart>
</Panel>
</Application>
MyStoplightWedgeRenderer:
<?xml version="1.0 "
encoding="utf-8"?>
<qc:StoplightWedgeRenderer
xmlns:qc="qs.charts.dataRenderers.*" xmlns="http://www.adobe.com/2006/mxml">
<qc:thresholds>
<qc:StoplightThreshold
value="0">
<qc:fill>
<SolidColor color="#00AA00"
/>
</qc:fill>
</qc:StoplightThreshold>
<qc:StoplightThreshold
value="50">
<qc:fill>
<SolidColor color="#AAAA00"
/>
</qc:fill>
</qc:StoplightThreshold>
<qc:StoplightThreshold
value="80">
<qc:fill>
<SolidColor color="#AA0000"
/>
</qc:fill>
</qc:StoplightThreshold>
</qc:thresholds>
</qc:StoplightWedgeRenderer>
MyStoplightWedgeRenderer2:
<?xml version="1.0"
encoding="utf-8"?>
<qc:StoplightWedgeRenderer
xmlns:qc="qs.charts.dataRenderers.* " xmlns="http://www.adobe.com/2006/mxml">
<qc:thresholds>
<qc:StoplightThreshold value="0">
<qc:fill>
<SolidColor color="#CCAACC" />
</qc:fill>
</qc:StoplightThreshold>
<qc:StoplightThreshold value="50">
<qc:fill>
<SolidColor color="#AAAACC" />
</qc:fill>
</qc:StoplightThreshold>
<qc:StoplightThreshold value="80">
<qc:fill>
<SolidColor color="#AACCCC" />
</qc:fill>
</qc:StoplightThreshold>
</qc:thresholds>
</qc:StoplightWedgeRenderer>
--
Jason