OK, i got it!!
i made the chart explode on mouse over a wedge, working
great !
next step: on click on a wedge the wedge will change color (or
alpha
or ratio), click on another wedge will revert the previous wedge
to
its original color and will change color of current wedge.
i got the
start of it, but i m stuck!!
i used setStyle to change the color but there
must be a better way -
like accessing the wedge directly and changing its own
style.
HOW ???
here is the code:
<?xml
version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="init()">
<mx:Script><![CDATA[
import
mx.charts.events.ChartItemEvent;
import
mx.collections.ArrayCollection;
import
mx.controls.Alert;
[Bindable]
private var
dataSet:ArrayCollection = new ArrayCollection([
{Month: "Jan",
Expenses: 150},
{Month: "Feb", Expenses: 200},
{Month: "BLOODKLAAT",
Expenses: 600},
{Month: "Mar", Expenses: 500}
]);
private var
lastIndex:Number;
private function boom(e:ChartItemEvent):void {
//
explode wedge
if(e.hitData.chartItem.index != lastIndex){
var
explodeWedge:Array =
[];
explodeWedge[e.hitData.chartItem.index] =
0.1;
chart.series[0].perWedgeExplodeRadius =
explodeWedge;
}
lastIndex =
e.hitData.chartItem.index
}
private function
changeColor(e:ChartItemEvent):void{
chart.series[0].setStyle("fills",[0xff0000,
0x00ff00,
0x0000ff, 0x000000]);
}
private function init():void
{
chart.addEventListener(ChartItemEvent.ITEM_ROLL_OVER,boom);
chart.addEventListener(ChartItemEvent.ITEM_CLICK,changeColor);
}
]]></mx:Script>
<mx:SeriesInterpolate
id="chartEffect" elementOffset="10"/>
<mx:Panel title="Event
handling" verticalGap="0">
<mx:PieChart id="chart"
dataProvider="{dataSet}" >
<mx:series>
<mx:PieSeries
labelPosition="inside"
field="Expenses"
showDataEffect="chartEffect"
>
<mx:fills>
<mx:SolidColor color="#ff0000"
/>
<mx:SolidColor color="#00ff00" />
<mx:SolidColor
color="#0000ff" />
<mx:SolidColor color="#00ffff"
/>
</mx:fills>
</mx:PieSeries>
</mx:series>
</mx:PieChart>
</mx:Panel>
</mx:Application>
---
In [EMAIL PROTECTED]ups.com,
"Ely Greenfield" <[EMAIL PROTECTED].> wrote:
>
>
>
>
> What error are you getting?
>
> PieSeries has a
property called called perWedgeExplodeRadius. This is an
> array of
values from 0 to 1. The Nth value in this array corresponds to
> how far
the nth value in the dataProvider should be exploded. 0 is no
> explode, 1
is fully exploded (which means there's no room to actually
> render
anything, so probably not what you want. Choose something in
>
between).
>
> So get the index of the item under the mouse (listen
for itemRollOver
> and itemRollOut events), and update the
perWedgeExplodeRadius property
> accordingly.
>
>
Ely.
>
>
>
>
________________________________
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com]
On
> Behalf Of shemeshkale
> Sent: Tuesday, October 31, 2006 12:42
AM
> To: [EMAIL PROTECTED]ups.com
>
Subject: [flexcoders] how to explode a wedge on mouse over?
>
>
>
> hello,
> i have a pieChart.
> how do i make a
specific wedge explode on mouse over on it?
> mouse out will revert the
explosion.
>
> plus:
> how do i alert the wedge under the
mouse?
> got this : mouseOver="Alert.show('over:
'+event.hitData.index)"
> but it is error, what is
right?
>