jh86 Posted June 10, 2009 Share Posted June 10, 2009 hi,i've got a short question. i've created a report with a piechart inside. for the keyexpression i used the days of a week ( "monday", "tuesday", etc.). now, when i enable the legend, these keys are in a unsorted order, but it would be nice if i could modify that order. first i thought they are ordered alphabetically, because they are strings, but they aren't ordered in that way.then i found the examples in the ireport ultimate guide, where the countries in the legend are ordered alphabetically. now my question is, how can i control the ordering? i found out, that if i use numbers for the key expression, they are sorted ascending. but how can i affect the ordering of strings?thank you for your help.sincerely, jh Link to comment Share on other sites More sharing options...
kchaudhry Posted June 10, 2009 Share Posted June 10, 2009 You can modiy your query and create a new column called something like "Order_". For this column you can do a case statementcase when table.day = 'Monday' then 1 when table.day = 'Tuesday' then 2and so on. Then include this new column in the "ORDER BY" statement of your query.Hope this helps! Link to comment Share on other sites More sharing options...
jh86 Posted June 12, 2009 Author Share Posted June 12, 2009 thank you, but the legend sorting don't follow the ordering of the query. i've tried that already.anyone else could help me :) ? thanks Link to comment Share on other sites More sharing options...
orson Posted July 31, 2009 Share Posted July 31, 2009 I'm running into the exact same problem. Ordering of the sql is not solving the problem of apparent random assignment of keyExpressions to slices of the pie chart.And to be perfectly clear, the legend always follows the series for coloring of pie slices. The problem is that my keyExpression is assigned to an apparently random slice (0,1,2,3,etc). Things I've tried1. Ordering sql2. <sortField name="slice_title"/> I'm using an mysql database from a servlet call in Jboss and exporting the report as html. Thanks for any assistance!Post Edited by orson at 07/31/2009 08:06 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now