Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
BAR CHART MULTIPLE X-AXIS - BIRT
RRK
<p>Hi,</p>
<p> </p>
<p>Could someone advise me on the below point ?</p>
<p> </p>
<p>This is related to BAR chart X-Axis.</p>
<p> </p>
<p>I am trying to create two x-axis but struggling to do so.</p>
<p> </p>
<p>Please find attached report.</p>
<p> </p>
<p>In this report, when we run it against "UK" it will show country and city information on x axis.</p>
<p> </p>
<p>But "UK" is getting repeated below every city, I want it to be like group.</p>
<p> </p>
<p>which means the output should show -</p>
<p> </p>
<p>"cowes" "Liverpool" "London" "Manchester"</p>
<p> "UK"</p>
<p> </p>
<p>So for all cities it should show one time "UK"</p>
<p> </p>
<p>BIRT version I am using is : 4.4.2</p>
<p> </p>
<p>Is it possible.</p>
<p> </p>
<p>Thanks in Advance !!!</p>
Find more posts tagged with
Comments
Clement Wong
<p>Sorry, buy there was no attached report design. Can you please attach so that we can review it?</p>
RRK
<p>Sorry for this.</p>
<p> </p>
<p>Please find attached report design.</p>
Clement Wong
<p>Maybe I'm oversimplifying, but can you just put a Data Item to display the Parameter "Country" under the Chart (and change the Category X Series back to row["CITY"])? See the attached modified version (1) of your report.</p>
<p> </p>
<p>Another method is to use the X-Axis Title as the place holder for the group name. See the attached modified version (2) of your report. The onRender event of the Chart was modified as follows:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">function beforeDrawAxisTitle( axis, label, icsc )<br>
{<br>
importPackage(Packages.org.eclipse.birt.chart.model.attribute);<br>
if(axis.getType() == AxisType.TEXT_LITERAL)<br>
{<br>
label.getCaption().setValue(icsc.getExternalContext().getScriptable().getParameterValue("Country"));<br>
}<br>
}</span></p>
RRK
<p>Hi,</p>
<p> </p>
<p>Thanks for your quick reply!!!</p>
<p> </p>
<p>Could you please let me know if we have more then one country how will we modify our report ?</p>
<p> </p>
<p>Please find attached report.</p>
<p> </p>
<p>In this case countries selection can be one country(eg : USA), or can be two countries (France,USA) or can be more then two (depends up on user) so in this case we cannot have a label at bottom, please correct me if I am wrong.</p>
Clement Wong
<p>Oh, your attached sample design only had one country. So what you actually want is two level axis labels for one or more groups.</p>
<p> </p>
<p>With OS BIRT, it is possible, but it may not be elegant. Checkout <a data-ipb='nomediaparse' href='
https://www.eclipse.org/forums/index.php?t=msg&th=237365&goto=720570&#msg_720570'>this
thread</a> for an example which you can modify. You may want use ":" in between Country and City and use JavaScript's string split (for example, yourStr.split(":")[0] to get the first element).</p>
<p> </p>
<p>With commercial BIRT, since it's HTML5 charts based on HighCharts, it's easier to manipulate and add two level axis labels in and look nicer.</p>
RRK
<p>Thanks for your reply!!!
</p>
<p> </p>
<p>I went through the thread earlier as well that's the reason I was trying it by placing "City"+ "\n" + "Country" at expression level.</p>
<p> </p>
<p>But got stuck after that.</p>
<p> </p>
<p>Could I request you to please create a chart in commercial birt and add two levels for "City" and "Country" using sample database?</p>
Clement Wong
<p>Attached is a sample using commercial BIRT (iHub 3.1) that shows two x-axis or grouped x-axis using HTML5 charts.</p>
<p> </p>
<p>1. Changed the Category X Axis to: <span style="font-family:'courier new', courier, monospace;">row["COUNTRY"] +":"+ row["STATE"]</span></p>
<p>We will later parse out the two levels using JavaScript's split function.</p>
<p> </p>
<p>2. Modified <em>beforeDrawAxis </em>event to change height of chart to make room for 2nd x-axis. Parsed out the subgroup (in example it is STATE) and change the labels.</p>
<p> </p>
<p>3. Added a script in the Chart Area > Load event to build out the new parent group for the 2nd x-axis, built out the tick marks to separate the parent group, added the 2nd x-axis and then formated the labels by centering them.</p>
<p> </p>
<p>
RRK
<p>Hi Clement,</p>
<p> </p>
<p>Thanks a lot for this solution.</p>
<p> </p>
<p>This is what I was looking for.</p>
<p> </p>
<p>Please let me know from where we can download the commercial birt (iHub 3.1) ?</p>
Clement Wong
<p>That's good to hear!</p>
<p> </p>
<p>You can download the commercial designer (formerly BIRT Designer Professional, now Analytics Designer) here
@<
;/p>
<p><a data-ipb='nomediaparse' href='
http://www.actuate.com/resources/product-downloads/'>http://www.actuate.com/resources/product-downloads/</a></p>
;
RRK
<p>Thanks Clement for your time!!!
</p>
remember_me
Hi. I don't see any attachment of this example. Can you please update the link?