Ok, so it looks like a (reasonably simple) way to do this is to set the dataProvider of the CategoryAxis to originalDataProvider.toArray().reverse() on every update of originalDataProvider. A ListCollectionView to wrap originalDataProvider would have been cleaner, but there doesn't seem to be a simple way to say "sort the opposite of how this is sorted by default". I tried to extend ListCollectionView into a ReverseListCollectionView by overriding getItemAt() and itemIndex(), but it looks like CategoryAxis actually uses IViewCursor, and I would have had to write my own. I think this solution works reasonably well for now.
-----Original Message----- From: flexcoders@yahoogroups.com on behalf of Maciek Sakrejda Sent: Sun 1/11/2009 3:39 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: CategoryAxis category order Hmm. No dice. Overriding describeData() to return super.describeData().reverse() does nothing... Maybe I'll go the ListCollectionView route. -----Original Message----- From: flexcoders@yahoogroups.com on behalf of Maciek Sakrejda Sent: Sun 1/11/2009 2:47 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: CategoryAxis category order Thanks, Amy. The nature of how we use charts would make a solution based around modifying the axis a lot simpler, but I may need to fall back to this approach. I think the problem is that an axis is unaware of its orientation, and left-to-right is isomorphic with bottom-to-top (to represent a cartesian chart with the standard x and y dimensions). This makes sense for numeric and datetime axes, but it seems counter-intuitive for a category axis. I wonder if I can monkey around with AxisBase.describeData()... -----Original Message----- From: flexcoders@yahoogroups.com on behalf of Amy Sent: Sun 1/11/2009 5:52 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: CategoryAxis category order --- In flexcoders@yahoogroups.com, Maciek Sakrejda <msakre...@...> wrote: > > When I have a data provider like > > [ { category : foo, val : 1 }, { category : bar, val : 2 },{ category : > baz, val : 3 } ] > > and graph this on a BarChart as category vs. val, the values are graphed > bottom to top. That is, category foo is on the bottom, then bar, then > baz at the top. Is there a way to reverse this order, and have the > categories as foo, bar, baz bottom-to-top without having to re-sort the > dataprovider (it is used elsewhere) or copy the data in reverse order > (I'd rather extend the charting components to do the "right thing")? How bout just creating a ListCollectionView that points to the same data and sort that?
<<winmail.dat>>