|
Re: Scaling Multiple Bar Charts [message #638045 is a reply to message #638036] |
Tue, 09 November 2010 17:50 |
|
Greg,
Not sure how you are doing the aggregate (would be great if you could
post an example using the sample db). But using the script approach
should work. To get the global variable use code like:
mar =
icsc.getExternalContext().getScriptable().getPersistentGloba lVariable( "myvar");
To scale it you could use a beforeGeneration script like:
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
xAxis = chart.getBaseAxes()[0];
yAxis = chart.getOrthogonalAxes( xAxis, true)[0]
yscale = yAxis.getScale();
yscale.setStep (10);
yscale.setMin( NumberDataElementImpl.create(1.5) )
yscale.setMax( NumberDataElementImpl.create(mar) )
yAxis.setScale(yscale);
Jason
On 11/9/2010 12:34 PM, Greg Clemenson wrote:
> This is probably really simple, but I don't know BIRT very well.
>
> I put a bar chart in table detail row column. Works great, however the
> scales are locally fine but globally inconsistent. The thought was to
> have one data series be the max value (computed as a column max
> aggregate) and use that to force identical scaling. As far as I can
> tell, one cannot get data aggregate values into a series no matter what
> you do. I tried creating a new data binding aggregating over entire
> table--chart ignored aggregate and showed individual row value. Tried
> heavy-duty approach: scripting. The thought here was to use some
> OnCreate code to put the max value in a global variable using
> reportContext.setPersistentGlobalVariable and then set the chart scale
> by retrieving the global variable value. Chart scripting only seems to
> have OnRender functions available for scripting and I could not figure
> out how to access the report context to retrieve the global variable value.
|
|
|
|
Re: Scaling Multiple Bar Charts [message #638301 is a reply to message #638283] |
Wed, 10 November 2010 18:07 |
|
Glad you got it working.
Jason
On 11/10/2010 12:05 PM, Greg Clemenson wrote:
> Your solution worked quite well. I now get a table with embedded charts
> that have identical scales.
>
> I did have to work a bit to get the aggregation to work properly. I
> ended up with an OnCreate script on the containing table with this code:
>
> var maxTime = Total.max(row["task_total_time"]);
> reportContext.setPersistentGlobalVariable("maxTime", "" + maxTime);
>
>
> In the second line, "" + maxTime converts the number maxTime to a
> string. Otherwise Java throws an error because the needed method
> signature is reportContext.setPersistentGlobalVariable(String, String).
>
> Thank you
>
|
|
|
Powered by
FUDForum. Page generated in 0.03586 seconds