|
Totally Kosher.
Ely.
So if it's a component, putting extra bits right inside the root tag is
kosher? Or just unavoidable and you'll look the other way?
On 6/29/06, Ely
Greenfield <[EMAIL PROTECTED]> wrote:
Ah,
gotcha. You're doing the right thing then. I thought your chart was nested
deeper inside a file somewhere.
Ely.
Sent: Thursday, June 29, 2006 9:56
AM
To: [email protected] Subject: Re:
[flexcoders] Ely: StoplightRenderer example doesn't work right in
release
Unfortunately, this is inside a component whose root tag is a chart.
So it's kind of hard to put them outside of that. :D Pity this is
how it works. It's VERY handy to have the ability to define components
in mxml form. Especially in the cases of things like itemRenderers that
are a lot more work in AS.
I'll just stick with this as a workaround
until I can patch the chart code. If I need something similar in the
future, I'll go through the full in-code method.
On 6/29/06, Ely
Greenfield <[EMAIL PROTECTED]> wrote:
FYI,
defining those PieSeries inside the piechart is not really a kosher thing to
do. Loose tags inside a chart are interpreted as items assigned to its
dataProvider. In your case, you're immediately redefining the
dataProvider to be something else, so it effectively gets ignored. But
really, arbitrary loose instances you want to create should be defined as
children of the root tag of the file.
Ely.
Sent: Wednesday, June 28, 2006 10:26
PM To: [email protected] Subject: Re:
[flexcoders] Ely: StoplightRenderer example doesn't work right in
release
Okay, here's how I worked around it for anyone else following the
thread.
I created my chart like this
(pseudo-code):
<PieChart id=chart> <PieSeries
id=series1 dataProvider=mydata/> <PieSeries id=series2
dataProvider=mydata/> </PieChart>
Notice that series1/2
are NOT inside a <series> tag.
In my update function, I have a
switch that decided which series should be active and did as
follows:
//series1.setStyle("showDataEffect", someEffect);
chart.series = [series1]; // set the series array to just this one
series chart.invalidateSeries();
The commented out line is in case
you have any effects. For some reason, they have to
reapplied.
If one of your series has a custom renderer like mine, you
can define it inline or assign it like so:
<PieSeries
id=series1 dataProvider=mydata
itemRenderer=CustomRenderer/>
On 6/28/06, Ely
Greenfield <
[EMAIL PROTECTED] > wrote:
Hmmm.
Honestly, I'm surprised that worked in beta 3. Regardless, the
series is caching instances of the itemRenderer, and not correctly
releasing them when you switch to a different renderer. The only
workaround I can see right now is to create a new PieSeries rather than
just changing the itemRenderer.
Ely.
From: [email protected] [mailto:
[email protected]] On Behalf Of Pan
Troglodytes Sent: Wednesday, June 28, 2006 2:54 PM To:
flexcoders Subject: [flexcoders] Ely: StoplightRenderer example
doesn't work right in release
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
-- Jason
-- Jason
-- Jason
__._,_.___
--
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
YAHOO! GROUPS LINKS
__,_._,___
|