Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Interchange the legends on a stacked bar
kukkri
Gurus,
Need advise on how to interchange the legend (ex: legA and legB) on a stacked bar chart. Right now legB shows up before legA. I need legA to show up first.
What is the best way to do it?
Find more posts tagged with
Comments
mwilliams
Hi kukkri,
In a stacked bar chart, the series' show up in the order in which they're stacked. The top bar is listed first, the next second, etc. You're not wanting it to follow this pattern?
kukkri
Hi Michael,
thats right...that is the requirement from the client. They want the bottom bar to show up first in the series. Is there any way? Right now its working as you mentioned.
mwilliams
kukkri,
If you did your own custom coloring, you could color the legend blocks in the order that you wanted and could just change the text in the legend labels to read in the order that you wanted.
For example, if you have 2 series, you could color series 1, red and series 2, blue. In your legend script, you'd color series 2's block red and change the label from series 2 to series 1. Then do the opposite for series 1's legend block.
kukkri
Hey Michael,
What would such a script actually look like and how would I go about doing the scripting for a legend?
Can you provide an example?
mwilliams
I can set one up. What version of BIRT are you using?
kukkri
Thanks.
My version is 3.2
mwilliams
I'm guessing that's BIRT 2.1.x? Can you confirm that in your xml source of a report design? 2.1.3 is the oldest version I have.
kukkri
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="
http://www.eclipse.org/birt/2005/design"
; version="3.2.17" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.3.2.v20090331-1440 Build <2.3.2.v20090331-1200></property>
<property name="units">in</property>
mwilliams
Perfect. I'll get one made in 2.3.2 and attach it when I get it done.
mwilliams
kukkri,
Take a look at this example. All the work is done in the 2 functions in the chart script.
kukkri
Thanks much. Works.
mwilliams
Great! Glad to help, as always!