Well, it's been a while but I've finally been able to get back to this.
Unfortunately, there are cases where this simply won't work. For example:
[Bindable] public var d:ArrayCollection = new ArrayCollection([
new ArrayCollection([
{x:1, y:1, z:10},
{x:2, y:2, z:20},
{x:3, y:3, z:30},
]),
new ArrayCollection([
{x:1, y:1, z:20},
{x:2, y:2, z:30},
{x:3, y:3, z:10},
])
]);
There is no way you can rearrange the second data such that it won't screw
up one of the bubbles.
I think I'm just going to have to get in there and hack at it to make it
stop trying it's "smart" bubble rearranging.
On Thu, Sep 25, 2008 at 2:36 AM, Cosmin Cojocar <[EMAIL PROTECTED]> wrote:
> Hello Jason,
>
> Here is a good code for what you want:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute">
> <mx:Script>
> <![CDATA[
> import mx.collections.ArrayCollection;
> [Bindable] public var d:ArrayCollection = new ArrayCollection([
> new ArrayCollection([
> {x:1, y:1, z:10},
> {x:2, y:2, z:20},
> {x:3, y:3, z:30},
> ]),
> new ArrayCollection([
> {x:2, y:2, z:20},
> {x:1, y:1, z:20},
> {x:3, y:3, z:30},
> ])
> ]);
>
> [Bindable] public var i:int = 0;
> ]]>
> </mx:Script>
>
> <mx:SeriesInterpolate id="interp" />
>
> <mx:BubbleChart>
> <mx:series>
> <mx:BubbleSeries id="series1" xField="x" yField="y" radiusField="z"
> creationComplete="series1.dataProvider = d[0]" showDataEffect="{interp}">
> <mx:fills>
> <mx:SolidColor color="red"/>
> <mx:SolidColor color="green"/>
> <mx:SolidColor color="blue"/>
> </mx:fills>
> </mx:BubbleSeries>
>
>
> </mx:series>
> </mx:BubbleChart>
> <mx:HBox>
> <mx:Button label="<" click="i--; series1.dataProvider = d[i]"
> enabled="{i != 0}"/>
> <mx:Button label=">" click="i++; series1.dataProvider = d[i]"
> enabled="{i != d.length - 1}"/>
> </mx:HBox>
> </mx:WindowedApplication>
>
> Explication:
>
> Your order is sorted according to Z field and after that the
> colors are attributed. So when you change the z value for (1,1) element this
> will be second value from red ball (3,3) not (2,2) because the order is made
> according to z value.
>
> *I also attached a small graphic explication in order.pdf (order
> matters) file.
>
> *I hope that is what you want. Have a nice day.
>
> Regards,
> Cosmin
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Tue, Sep 23, 2008 at 12:01 AM, Pan Troglodytes <[EMAIL PROTECTED]>wrote:
>
>> Following is a simplified example of what I'm running into. Basically,
>> BubbleSeries doesn't preserve the order of the bubbles when you switch the
>> dataprovider. Run the following program and click the left and right
>> buttons.
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
>> layout="vertical">
>> <mx:Script>
>> <![CDATA[
>> import mx.collections.ArrayCollection;
>> [Bindable] public var d:ArrayCollection = new ArrayCollection([
>> new ArrayCollection([
>> {x:1, y:1, z:10},
>> {x:2, y:2, z:20},
>> {x:3, y:3, z:30},
>> ]),
>> new ArrayCollection([
>> {x:1, y:1, z:20},
>> {x:2, y:2, z:20},
>> {x:3, y:3, z:30},
>> ])
>> ]);
>>
>> [Bindable] public var i:int = 0;
>> ]]>
>> </mx:Script>
>>
>> <mx:SeriesInterpolate id="interp" />
>>
>> <mx:BubbleChart>
>> <mx:series>
>> <mx:BubbleSeries id="series1" xField="x" yField="y" radiusField="z"
>> creationComplete="series1.dataProvider = d[0]" showDataEffect="{interp}">
>> <mx:fills>
>> <mx:SolidColor color="red"/>
>> <mx:SolidColor color="green"/>
>> <mx:SolidColor color="blue"/>
>> </mx:fills>
>> </mx:BubbleSeries>
>>
>>
>> </mx:series>
>> </mx:BubbleChart>
>> <mx:HBox>
>> <mx:Button label="<" click="i--; series1.dataProvider = d[i]"
>> enabled="{i != 0}"/>
>> <mx:Button label=">" click="i++; series1.dataProvider = d[i]"
>> enabled="{i != d.length - 1}"/>
>> </mx:HBox>
>> </mx:Application>
>>
>> What happens is that the blue bubble swaps places with the green bubble
>> and then grows to the size of the green bubble. What I want is for the blue
>> bubble to just grow in place and have the green bubble stay put. Is there
>> some way I'm missing to tell the chart to pay attention to the order of the
>> data? I thought maybe it had something to do with transitionRenderData, but
>> the documentation on it is rather ... brief.
>>
>> --
>> Jason
>>
>
>
>
--
Jason