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)
A bar chart with 2 group names as x-axis values ?
germobirt
I've a bar chart based on a table with 2 groups.<br />
<br />
<span style='color: #006400'>I have a db query with that 2 column data<br />
<span style='font-family: Courier New'><br />
Theme | InTime<br />
<br />
Theme A | Yes<br />
Theme A | Yes<br />
Theme B | Yes<br />
Theme B | No<br />
Theme A | Yes</span><br />
...</span><br />
<br />
<span style='color: #0000FF'>I have a birt report table with 2 groups (Theme and InTime) and a count aggregation on Yes and No<br />
<span style='font-family: Courier New'><br />
Theme A<br />
<ul class='bbc'><li> Yes 10</li><li> No 15</li></ul>
Theme B<br />
<ul class='bbc'><li> Yes 20</li><li> No 35</li></ul>
Theme C<br />
<ul class='bbc'><li> Yes 12</li><li> No 40</li></ul>
Theme D<br />
<ul class='bbc'><li> Yes 06</li><li> No 33</li></ul>
</span></span><br />
<br />
I have a bar chart that shows me the Yes and No counts for each theme.<br />
<br />
It looks like that <br />
The names of the 2nd (aggregated) groups are under the bars.<br />
<br />
<span style='color: #A0522D'><span style='font-family: Courier New'><br />
10 | 15 | 20 | 35 | 12 | 40 | 06 | 33 <br />
<br />
Yes | No | Yes | No | Yes | No | Yes | No <br />
</span></span><br />
<br />
But I need a bar chart like that. <br />
The name of both groups under the bars.<br />
<br />
<span style='color: #556B2F'><span style='font-family: Courier New'><br />
10 | 15 | 20 | 35 | 12 | 40 | 06 | 33 <br />
<br />
Yes | No | Yes | No | Yes | No | Yes | No <br />
Theme A | Theme B | Theme C | Theme D <br />
</span></span><br />
<br />
or even better only the 2nd groups<br />
<br />
<span style='color: #006400'><span style='font-family: Courier New'><br />
10 | 15 | 20 | 35 | 12 | 40 | 06 | 33 <br />
<br />
Theme A | Theme B | Theme C | Theme D <br />
</span></span><br />
<br />
For to see which bar is Yes and wich is No I want to color them in green(Yes) and red(No)<br />
<br />
<br />
In Crystal Report I've achieved that.<br />
There I can define for the data "On Change of : 1.) Theme & 2.) InTime"<br />
<br />
Now I'm using Birt 2.6.2<br />
<br />
How can I get a bar chart like the 2nd and 3rd example?<br />
<br />
<br />
best regards
Find more posts tagged with
Comments
mwilliams
Take a look at this design. It does the last option. I didn't do the colors, but you should be able to do that easily with the chart palette or script. Let me know if you have issues.
germobirt
Yupp, that's it!
<New Series...> is what I needed.
And the 2 footer rows is better than my 1. try with one.
thanks thanks ...
mwilliams
You're very welcome. Let us know whenever you have questions!
shyamgoda
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="101244" data-time="1337796675" data-date="23 May 2012 - 11:11 AM"><p>
You're very welcome. Let us know whenever you have questions!
<br /></p></blockquote>
<br />
Hello MWilliams,<br />
I have a similar requirement with a little twist. The grouping "MGRGROUPING" on my table is based on Manager_ID, whereas I want to display the corresponding Manager_Name on the Chart's X-Axis. I used row["MGRGROUPING"] for X-axis and 2 group-level calculated column-bindings in the Y-axis series.<br />
<br />
How to achieve this? Thanks in advance.<br />
<br />
regards,<br />
Shyam
mwilliams
You could always store the manager name in a persistent global variable in your dataSet script and name the pgv by the manager id. This way, you can recall the pgv with the current label value and replace the label with the name. That's one option. Let me know if you have questions.
shyamgoda
Thanks for the suggestion. I shall try to implement that way. I suppose that you meant to access the pgv in the "beforeDrawAxisLabel" kind of event for each label? In my report, I would have multiple sets of MgrID/MgrName per report generation. Is it ok to set so many pgv's or do you suggest using an array?
Is there any other way to access the corresponding value from the table-group or dataset itself?
BTW, I had tried using pgv earlier in beforeFactory/afterFactory events (setting pgv) and in onPrepare/onRender events (getting pgv) of a label to show the time-taken-for-report-generation, but it gave null. The afterFactory or label-events were probably a wrong place for reading latest pgv value. Guidance on that would also help.
mwilliams
You could possibly group your table on row["manager_id"] + "-" + row["manager_name"], which would generate the same grouping, then in your chart script, you could simply remove the '-' and everything before it, from the label. Just another idea.
As for timing your report, why not use java.io and write a time stamp out to a text file in the initialize then in the afterfactory or afterrender and then you'd know the time. You could log times for any section of the report you'd like with this.