Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Changing aggregate expression of chart series based on report parameter
Changing aggregate expression of chart series based on report parameter [message #869442] Thu, 03 May 2012 12:08 Go to next message
Ruben Durk is currently offline Ruben DurkFriend
Messages: 8
Registered: April 2012
Junior Member
I have trouble finding the right handles to change the aggregate expression of some line series based on a report paramter. Especially because content assist doesn't pop up.

index.php/fa/9291/0/

In my beforefactory event handler, I was able to change the grouping of the x-axis with:

var mychart = this.getReportElement("mainChart");
mychart.getCategory().getGrouping().setGroupUnit(reportContext.getParameterValue("grouping"));

However, don't want to change the category axis, but the y axis. I'm unable to get to the right object to call setAggregateExpression. According to the API I should get to the SeriesGrouping object.
  • Attachment: naamloos.JPG
    (Size: 180.76KB, Downloaded 1107 times)
Re: Changing aggregate expression of chart series based on report parameter [message #869679 is a reply to message #869442] Thu, 03 May 2012 17:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

It should be doable in the beforeFactory like:


importPackage(Packages.org.eclipse.birt.chart.model.data.impl);

//Chart must be named
cht =
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("MyChart");
mychart = cht.getReportItem().getProperty( "chart.instance" );
var xAxis = mychart.getAxes().get(0);
var yAxis = xAxis.getAssociatedAxes().get(0);

var xSerieDef = xAxis.getSeriesDefinitions().get(0);
var ySerieDef = yAxis.getSeriesDefinitions().get(0);
var yq = ySerieDef.getGrouping();

var yg = yq.setAggregateExpression(params["ChartAggregate"].value);

See attached example


Jason

On 5/3/2012 8:08 AM, Ruben Durk wrote:
> I have trouble finding the right handles to change the aggregate expression of some line series based on a report paramter. Especially because content assist doesn't pop up.
>
>
>
> In my beforefactory event handler, I was able to change the grouping of the x-axis with:
>
> var mychart = this.getReportElement("mainChart");
> mychart.getCategory().getGrouping().setGroupUnit(reportContext.getParameterValue("grouping"));
> However, don't want to change the category axis, but the y axis. I'm unable to get to the right object to call setAggregateExpression. According to the API I should get to the SeriesGrouping object.
Re: Changing aggregate expression of chart series based on report parameter [message #869786 is a reply to message #869679] Fri, 04 May 2012 10:04 Go to previous messageGo to next message
Ruben Durk is currently offline Ruben DurkFriend
Messages: 8
Registered: April 2012
Junior Member
Hey Jason,

Again, thanks for your help! However, this doesn't work for me. Running it in debug mode I found out that yq becomes null since the ySeriesDef has no grouping. I started exploring in the variables view while in debug mode, and I found the variable I'd like to change. But I have no idea how to reach it.

Starting at ySeriesDef, the last defined variable before yq:
ySeriesDef -> series -> data -> [0] -> dataDefinition -> data -> [0] -> grouping
There is the aggregate expression i'd like to modify.

I've also included my report design, however, it uses a database, so I'm not sure whether this would be useful.
Re: Changing aggregate expression of chart series based on report parameter [message #869875 is a reply to message #869786] Fri, 04 May 2012 15:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Ruben

Have a look at the attached image. Tell me which one are you trying to
change.

Jason

On 5/4/2012 6:04 AM, Ruben Durk wrote:
> Hey Jason,
>
> Again, thanks for your help! However, this doesn't work for me. Running it in debug mode I found out that yq becomes null since the ySeriesDef has no grouping. I started exploring in the variables view while in debug mode, and I found the variable I'd like to change. But I have no idea how to reach it.
>
> Starting at ySeriesDef, the last defined variable before yq:
> ySeriesDef -> series -> data -> [0] -> dataDefinition -> data -> [0] -> grouping
> There is the aggregate expression i'd like to modify.
>
> I've also included my report design, however, it uses a database, so I'm not sure whether this would be useful.
Re: Changing aggregate expression of chart series based on report parameter [message #870444 is a reply to message #869875] Tue, 08 May 2012 09:30 Go to previous messageGo to next message
Ruben Durk is currently offline Ruben DurkFriend
Messages: 8
Registered: April 2012
Junior Member
Hey Jason,

The seriesgrouping on the Y series definition
Re: Changing aggregate expression of chart series based on report parameter [message #870580 is a reply to message #870444] Tue, 08 May 2012 20:14 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Ruben

Take a look at :
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1508-change-aggregate-function-on-chart-series/

Jason

On 5/8/2012 5:30 AM, Ruben Durk wrote:
> Hey Jason,
>
> The seriesgrouping on the Y series definition
Previous Topic:Floating Text around Pictures
Next Topic:Sorting in Cross tab is not working
Goto Forum:
  


Current Time: Fri Mar 29 01:31:40 GMT 2024

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

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

Back to the top