Home » Archived » BIRT » Max y-axis value on split bar chart (birt 2.6.2)
|
Re: Max y-axis value on split bar chart [message #905619 is a reply to message #905178] |
Thu, 30 August 2012 18:55 |
|
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 |
Shusen Zhang 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 |
|
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 #908593 is a reply to message #908145] |
Wed, 05 September 2012 16:03 |
|
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.
>
>
>
>
|
|
|
Goto Forum:
Current Time: Sat Nov 09 02:04:07 GMT 2024
Powered by FUDForum. Page generated in 0.03705 seconds
|