Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Bar chart with multiple axis
Bar chart with multiple axis [message #829632] Mon, 26 March 2012 15:23 Go to next message
ing omini is currently offline ing ominiFriend
Messages: 26
Registered: March 2012
Junior Member
Hi everybody,

I want to create a birt bar chart having:
- a category x axis (example: product name)
- two data series (example: number of purchases and total € amount)

If I use a single y axis and choose "side by side" , the two series are displayed correctly, but not very readable because the two series have different value ranges (example: 0-100 for series1, 0-100.000 for series2).

So I need to use multiple y axis.
Here comes the problem: in the multiple axis mode, the bars belonging to the two data series are no more side by side, but overlapped.

What can I do to have them side by side again?

Thanks

Re: Bar chart with multiple axis [message #829640 is a reply to message #829632] Mon, 26 March 2012 15:30 Go to previous messageGo to next message
ing omini is currently offline ing ominiFriend
Messages: 26
Registered: March 2012
Junior Member
Additional info:
I know that there are also 2D charts with depth, but it's not what I need.

If side-to-side option is not available, as a solution it would be good also to have bars with different width (the thinnest in front, the widest back)
Re: Bar chart with multiple axis [message #830748 is a reply to message #829632] Wed, 28 March 2012 02:38 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Set the side by side field for the two y-axis. See attached report. If
using CE API use:
//do on both axis
yAxisPrimary.setSideBySide(true);

Jason

On 3/26/2012 11:23 AM, ing omini wrote:
> Hi everybody,
>
> I want to create a birt bar chart having:
> - a category x axis (example: product name)
> - two data series (example: number of purchases and total € amount)
>
> If I use a single y axis and choose "side by side" , the two series are
> displayed correctly, but not very readable because the two series have
> different value ranges (example: 0-100 for series1, 0-100.000 for series2).
>
> So I need to use multiple y axis. Here comes the problem: in the
> multiple axis mode, the bars belonging to the two data series are no
> more side by side, but overlapped.
>
> What can I do to have them side by side again?
>
> Thanks
>
>
  • Attachment: bar2axis.zip
    (Size: 5.26KB, Downloaded 411 times)
Re: Bar chart with multiple axis [message #832550 is a reply to message #830748] Fri, 30 March 2012 09:15 Go to previous messageGo to next message
ing omini is currently offline ing ominiFriend
Messages: 26
Registered: March 2012
Junior Member
I have been using BIRT report designer for years on a basic level (dataset, "basic" charts, and so on..), but I am still a newbie (as you can see Very Happy ) regarding BIRt scripting.
That's why I am not sure I've understood correctly.

Just to summarize:
- inside my .rptdesign (created with BIRT designer version 2.3.2 ), I've added a bar chart with two series , to be displayed on multiple axis
- in script tab, I inserted a new function:

function beforeGeneration( chart, icsc )
{

var xAxis = chart.getAxes().get(0);
var yAxisPrimary = xAxis.getAssociatedAxes().get(0);
var yAxisSecondary = xAxis.getAssociatedAxes().get(1);

yAxisPrimary.setSideBySide(true);
yAxisSecondary.setSideBySide(true);

}



The returned error when generating the preview is

" TypeError: Cannot find function setSideBySide. at line 8 of chart script:'' "

What's my mystake??

Thanks again
Re: Bar chart with multiple axis [message #832911 is a reply to message #832550] Fri, 30 March 2012 18:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are doing this in the designer just use the gui. See attached
screenshot.

Jason

On 3/30/2012 5:15 AM, ing omini wrote:
> I have been using BIRT report designer for years on a basic level
> (dataset, "basic" charts, and so on..), but I am still a newbie (as you
> can see :d ) regarding BIRt scripting.
> That's why I am not sure I've understood correctly.
>
> Just to summarize: - inside my .rptdesign (created with BIRT designer
> version 2.3.2 ), I've added a bar chart with two series , to be
> displayed on multiple axis
> - in script tab, I inserted a new function:
>
>
> function beforeGeneration( chart, icsc )
> {
>
> var xAxis = chart.getAxes().get(0);
> var yAxisPrimary = xAxis.getAssociatedAxes().get(0);
> var yAxisSecondary = xAxis.getAssociatedAxes().get(1);
>
> yAxisPrimary.setSideBySide(true);
> yAxisSecondary.setSideBySide(true);
>
> }
>
>
>
> The returned error when generating the preview is
> " TypeError: Cannot find function setSideBySide. at line 8 of chart
> script:'' "
>
> What's my mystake??
>
> Thanks again
Re: Bar chart with multiple axis [message #832915 is a reply to message #832550] Fri, 30 March 2012 18:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are doing this in the designer just use the gui. See attached
screenshot.

Jason

On 3/30/2012 5:15 AM, ing omini wrote:
> I have been using BIRT report designer for years on a basic level
> (dataset, "basic" charts, and so on..), but I am still a newbie (as you
> can see :d ) regarding BIRt scripting.
> That's why I am not sure I've understood correctly.
>
> Just to summarize: - inside my .rptdesign (created with BIRT designer
> version 2.3.2 ), I've added a bar chart with two series , to be
> displayed on multiple axis
> - in script tab, I inserted a new function:
>
>
> function beforeGeneration( chart, icsc )
> {
>
> var xAxis = chart.getAxes().get(0);
> var yAxisPrimary = xAxis.getAssociatedAxes().get(0);
> var yAxisSecondary = xAxis.getAssociatedAxes().get(1);
>
> yAxisPrimary.setSideBySide(true);
> yAxisSecondary.setSideBySide(true);
>
> }
>
>
>
> The returned error when generating the preview is
> " TypeError: Cannot find function setSideBySide. at line 8 of chart
> script:'' "
>
> What's my mystake??
>
> Thanks again
Re: Bar chart with multiple axis [message #832920 is a reply to message #832550] Fri, 30 March 2012 18:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are doing this in the designer just use the gui. See attached
screenshot.

Jason

On 3/30/2012 5:15 AM, ing omini wrote:
> I have been using BIRT report designer for years on a basic level
> (dataset, "basic" charts, and so on..), but I am still a newbie (as you
> can see :d ) regarding BIRt scripting.
> That's why I am not sure I've understood correctly.
>
> Just to summarize: - inside my .rptdesign (created with BIRT designer
> version 2.3.2 ), I've added a bar chart with two series , to be
> displayed on multiple axis
> - in script tab, I inserted a new function:
>
>
> function beforeGeneration( chart, icsc )
> {
>
> var xAxis = chart.getAxes().get(0);
> var yAxisPrimary = xAxis.getAssociatedAxes().get(0);
> var yAxisSecondary = xAxis.getAssociatedAxes().get(1);
>
> yAxisPrimary.setSideBySide(true);
> yAxisSecondary.setSideBySide(true);
>
> }
>
>
>
> The returned error when generating the preview is
> " TypeError: Cannot find function setSideBySide. at line 8 of chart
> script:'' "
>
> What's my mystake??
>
> Thanks again
Re: Bar chart with multiple axis [message #832925 is a reply to message #832550] Fri, 30 March 2012 18:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are doing this in the designer just use the gui. See attached
screenshot.

Jason

On 3/30/2012 5:15 AM, ing omini wrote:
> I have been using BIRT report designer for years on a basic level
> (dataset, "basic" charts, and so on..), but I am still a newbie (as you
> can see :d ) regarding BIRt scripting.
> That's why I am not sure I've understood correctly.
>
> Just to summarize: - inside my .rptdesign (created with BIRT designer
> version 2.3.2 ), I've added a bar chart with two series , to be
> displayed on multiple axis
> - in script tab, I inserted a new function:
>
>
> function beforeGeneration( chart, icsc )
> {
>
> var xAxis = chart.getAxes().get(0);
> var yAxisPrimary = xAxis.getAssociatedAxes().get(0);
> var yAxisSecondary = xAxis.getAssociatedAxes().get(1);
>
> yAxisPrimary.setSideBySide(true);
> yAxisSecondary.setSideBySide(true);
>
> }
>
>
>
> The returned error when generating the preview is
> " TypeError: Cannot find function setSideBySide. at line 8 of chart
> script:'' "
>
> What's my mystake??
>
> Thanks again
Re: Bar chart with multiple axis [message #832928 is a reply to message #832550] Fri, 30 March 2012 18:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are doing this in the designer just use the gui. See attached
screenshot.

Jason

On 3/30/2012 5:15 AM, ing omini wrote:
> I have been using BIRT report designer for years on a basic level
> (dataset, "basic" charts, and so on..), but I am still a newbie (as you
> can see :d ) regarding BIRt scripting.
> That's why I am not sure I've understood correctly.
>
> Just to summarize: - inside my .rptdesign (created with BIRT designer
> version 2.3.2 ), I've added a bar chart with two series , to be
> displayed on multiple axis
> - in script tab, I inserted a new function:
>
>
> function beforeGeneration( chart, icsc )
> {
>
> var xAxis = chart.getAxes().get(0);
> var yAxisPrimary = xAxis.getAssociatedAxes().get(0);
> var yAxisSecondary = xAxis.getAssociatedAxes().get(1);
>
> yAxisPrimary.setSideBySide(true);
> yAxisSecondary.setSideBySide(true);
>
> }
>
>
>
> The returned error when generating the preview is
> " TypeError: Cannot find function setSideBySide. at line 8 of chart
> script:'' "
>
> What's my mystake??
>
> Thanks again
Re: Bar chart with multiple axis [message #834663 is a reply to message #832911] Mon, 02 April 2012 08:25 Go to previous messageGo to next message
ing omini is currently offline ing ominiFriend
Messages: 26
Registered: March 2012
Junior Member
Unfortunately in my version (2.3.2.r232) the only options available under axis tab are:
- visible
- type
- color

"aligned" and "side by side" options are not available in the GUI

is there any workaround to achieve the same effect?


Thanks again!
Re: Bar chart with multiple axis [message #835717 is a reply to message #834663] Tue, 03 April 2012 15:33 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I do not think 2.3.2 had this feature, but you can check the xml view
and do a search for <SideBySide> in the chart xml.

Jason

On 4/2/2012 4:25 AM, ing omini wrote:
> Unfortunately in my version (2.3.2.r232) the only options available
> under axis tab are:
> - visible
> - type
> - color
>
> "aligned" and "side by side" options are not available in the GUI
>
> is there any workaround to achieve the same effect?
>
>
> Thanks again!
Previous Topic:BIRT and Buckminster
Next Topic:data string to time in computed column
Goto Forum:
  


Current Time: Thu Mar 28 23:26:36 GMT 2024

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

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

Back to the top