Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Max y-axis value on split bar chart (birt 2.6.2)
Max y-axis value on split bar chart [message #905178] Wed, 29 August 2012 21:37 Go to next message
Shusen Zhang is currently offline Shusen ZhangFriend
Messages: 4
Registered: August 2012
Junior Member
I created a bar chart with flip axis. The x-axis will display about 100 categories, so I split the bar chart onto multiple pages by putting the bar chart in a table group and made the chart display 30 categories per page, this works properly.

Now, the issue is the max y-axis values on the pages are different.

For the y-axis, I tried to use JavaScript to set the y-scale to the max value. This did not solve the issue. Now, I have added a computed column for max y-axis value in dataset, and I hope I can set the max y-scale value with it, but I don't know how to get it in bar chart. Could anybody help me?

Thanks advance.

index.php/fa/11325/0/
index.php/fa/11326/0/
Re: Max y-axis value on split bar chart [message #905619 is a reply to message #905178] Thu, 30 August 2012 18:55 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Take a look at this example:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1538-group-chart-scale-change/

Jason


On 8/29/2012 5:37 PM, Shusen Zhang wrote:
> I created a bar chart with flip axis. The x-axis will display about 100 categories, so I split the bar chart onto multiple pages by putting the bar chart in a table group and made the chart display 30 categories per page, this works properly.
>
> Now, the issue is the max y-axis values on the pages are different.
>
> For the y-axis, I tried to use JavaScript to set the y-scale to the max value. This did not solve the issue. Now, I have added a computed column for max y-axis value in dataset, and I hope I can set the max y-scale value with it, but I don't know how to get it in bar chart. Could anybody help me?
>
> Thanks advance.
>
>
>
Re: Max y-axis value on split bar chart [message #906092 is a reply to message #905178] Fri, 31 August 2012 15:49 Go to previous messageGo to next message
Shusen Zhang is currently offline Shusen ZhangFriend
Messages: 4
Registered: August 2012
Junior Member
Thanks Jason,

I tried the example you provided, unfortunately, it cannot solve the issue. I think I should give more detail description:
1. adding dataSet column [matTotal]to the table header (the bar chart in the table)
2. onRender:
reportContext.setGlobalVariable("maxscale",this.getValue());
(this is good, I get maxscale is 67, for example)
3. beforeGeneration:
yscale.setMax( NumberDataElementImpl.create(icsc.getExternalContext().getScriptable().getGlobalVariable("maxscale")) );
(the issue is here, the max scale value is not always 67 on each page, it dynamically changes depend on the maxscale for that page, see the attachments above).

So, how can I let all pages keep same max scale value(i.e. 67)?

Thanks

Shusen

[Updated on: Fri, 31 August 2012 15:50]

Report message to a moderator

Re: Max y-axis value on split bar chart [message #906206 is a reply to message #906092] Fri, 31 August 2012 20:57 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you want all to have the same max scale just do a check to see if the
variable exists if it does not, set it only on the first oncreate (not
onrender) script and persist it.

if( reportContext.getPersistentGlobalVariable("maxscal") == null ){
reportContext.setPersistentGlobalVariable("maxscale",this.getValue());
}

Jason

On 8/31/2012 11:49 AM, Shusen Zhang wrote:
> Thanks Jason,
>
> I tried the example you provided, unfortunately, it cannot solve the
> issue. I think I should give more detail description:
> 1. adding dataSet column [matTotal]to the table header (the bar chart in
> the table)
> 2. onRender:
> reportContext.setGlobalVariable("maxscale",this.getValue());
> (this is good, I get maxscale is 67, for example)
> 3. beforeGeneration:
> yscale.setMax(
> NumberDataElementImpl.create(icsc.getExternalContext().getScriptable().getGlobalVariable("maxscale"))
> );
> (the issue is here, the max scale value is not always 67 on each
> page, it dynamically changes depend on the maxscale for that page, see
> the attachments above).
>
> So, how can I let all pages keep same max scale value(i.e. 67)?
>
Re: Max y-axis value on split bar chart [message #908145 is a reply to message #906206] Tue, 04 September 2012 20:33 Go to previous messageGo to next message
Shusen Zhang is currently offline Shusen ZhangFriend
Messages: 4
Registered: August 2012
Junior Member
Jason Weathersby wrote on Fri, 31 August 2012 16:57
If you want all to have the same max scale just do a check to see if the
variable exists if it does not, set it only on the first oncreate (not
onrender) script and persist it.

if( reportContext.getPersistentGlobalVariable("maxscal") == null ){
reportContext.setPersistentGlobalVariable("maxscale",this.getValue());
}

Jason

>


Thanks Jason, this is exactly what I want.

I have another similar question on the same report: from my first question you can see the x-axis position is vary on each page accordance with the max length of the category label, now I want to fix x-axis position.

What should I do?

I tried to use fixed label span on third tab manually, it seems like the Bug 314708 still exist when I tested it on 3.7.2 runtime.



Re: Max y-axis value on split bar chart [message #908564 is a reply to message #908145] Wed, 05 September 2012 15:12 Go to previous messageGo to next message
Shusen Zhang is currently offline Shusen ZhangFriend
Messages: 4
Registered: August 2012
Junior Member
I solved the issue,thank you so much.


Shusen Zhang wrote on Tue, 04 September 2012 16:33
Jason Weathersby wrote on Fri, 31 August 2012 16:57
If you want all to have the same max scale just do a check to see if the
variable exists if it does not, set it only on the first oncreate (not
onrender) script and persist it.

if( reportContext.getPersistentGlobalVariable("maxscal") == null ){
reportContext.setPersistentGlobalVariable("maxscale",this.getValue());
}

Jason

>


Thanks Jason, this is exactly what I want.

I have another similar question on the same report: from my first question you can see the x-axis position is vary on each page accordance with the max length of the category label, now I want to fix x-axis position.

What should I do?

I tried to use fixed label span on third tab manually, it seems like the Bug 314708 still exist when I tested it on 3.7.2 runtime.




Re: Max y-axis value on split bar chart [message #908593 is a reply to message #908145] Wed, 05 September 2012 16:03 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

According to the bugzilla entry this was fixed. You may want to add a
comment to the bug. You could always write a beforeDrawAxisLabel script
to trim the lengths as well.

Jason

On 9/4/2012 4:33 PM, Shusen Zhang wrote:
> Jason Weathersby wrote on Fri, 31 August 2012 16:57
>> If you want all to have the same max scale just do a check to see if
>> the variable exists if it does not, set it only on the first oncreate
>> (not onrender) script and persist it.
>>
>> if( reportContext.getPersistentGlobalVariable("maxscal") == null ){
>> reportContext.setPersistentGlobalVariable("maxscale",this.getValue());
>> }
>>
>> Jason
>>
>> >
>
>
> Thanks Jason, this is exactly what I want.
>
> I have another similar question on the same report: from my first
> question you can see the x-axis position is vary on each page accordance
> with the max length of the category label, now I want to fix x-axis
> position.
>
> What should I do?
>
> I tried to use fixed label span on third tab manually, it seems like the
> Bug 314708 still exist when I tested it on 3.7.2 runtime.
>
>
>
>
Previous Topic:How to include a runtime value in a rpttemplate file
Next Topic:Chart API - How to make legend appear on top of the chart
Goto Forum:
  


Current Time: Fri Mar 29 00:33:54 GMT 2024

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

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

Back to the top