Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Sort chart category by value?(In a vertical bar chart, how can I sort the Category (X) Series by the Value (Y) series?)
icon5.gif  Sort chart category by value? [message #490203] Wed, 07 October 2009 19:21 Go to next message
Jack Repenning is currently offline Jack RepenningFriend
Messages: 5
Registered: July 2009
Junior Member
In building a vertical bar chart, how can I sort the bars (the "category") by their values?

I've actually found a way to make the "Edit Chart: Chart Preview" look right, but the resulting actual chart does not.

It would also be acceptable to arrange the category in the order of the data set, since I've already had the database order things properly. But I can't figger that one out, neither.

My data looks like this:
Count: Client Family
223: MSIE
201: SVN
175: Firefox
113: Apache
....


The query is
select count(1) 'Count', clientfamily 'Client Family'
from access natural join clientfamilyDIM
group by 2
order by 1 desc
limit 20


I've tried a lot of settings, and more than half suspect that part of my problem is some left-over from some setting I've since turned off, but at any rate my present chart settings are:

Value (Y) Series: row["Count"]
Category (X) Series: row["clientfamily"] unsorted
Optional Y Series Grouping: row["clientfamily"] data sorting:  descending sort on row["Count"]


The Chart Preview (attached) looks right: the first bar is the tallest bar, and it's colored to match the first legend color patch, which is labeled MSIE, and the value of the first bar is a bit over 220; and so on for the rest of the displayed bars, which gradually get shorter, left to right. Just what I want.

But the generated chart (also attached) has both the bars ("Category") and the legend ("Grouping") in alphabetical order.

(Hmph. "Upload File" may be unworking. Hope you can follow my description without the attachments.)
Re: Sort chart category by value? [message #490212 is a reply to message #490203] Wed, 07 October 2009 21:02 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Hi Jack,

So, in your example, you would want the x-axis ordered like:

MSIE, SVN, Firefox, Apache from left to right?

and when you run the report, it's going in order of:

Apache, Firefox, MSIE, SVN (alphabetical order)?

Regards,

Michael Williams
www.birt-exchange.org
Re: Sort chart category by value? [message #490217 is a reply to message #490212] Wed, 07 October 2009 21:38 Go to previous messageGo to next message
Jack Repenning is currently offline Jack RepenningFriend
Messages: 5
Registered: July 2009
Junior Member
Exactly.
Re: Sort chart category by value? [message #490219 is a reply to message #490217] Wed, 07 October 2009 22:01 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Jack,

What version of BIRT are you using? Your setup is exactly how I would say it should be.
Re: Sort chart category by value? [message #490224 is a reply to message #490219] Wed, 07 October 2009 22:18 Go to previous message
Jack Repenning is currently offline Jack RepenningFriend
Messages: 5
Registered: July 2009
Junior Member
BIRT 2.5.1.v20090629 for all components

Eclipse Platform 3.5.1.R35x_v2009

Data source driver: mysql-connector-java-5.1.10-bin.jar


Oh, wait, this is interesting:

I had not yet quit Eclipse since I started this, so I thought I'd try that (you know, "when in doubt, boot it out").

When I relaunched, the chart preview in the edit-chart window was "wrong", in the same sense discussed here.

I checked the chart settings, and the "Grouping" sort had lost its setting, gone to Unsorted (that is, was consistent with the actual display in the chart preview).

I set it to Descending, on Count, as before, and as before the Chart Preview in the Edit Chart window then looked right.

I "[Finish]ed" that, and selected the (report editor) /Preview\ tab, producing the generated chart.

Now, it looks as desired.

Gremlins.

[Updated on: Wed, 07 October 2009 22:34]

Report message to a moderator

Previous Topic:Setting the thickness of the border in Bar graph through script
Next Topic:Possible Memory Leak in ViewerServlet
Goto Forum:
  


Current Time: Thu Apr 25 21:11:06 GMT 2024

Powered by FUDForum. Page generated in 0.03285 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top