|
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 |
|
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 #869875 is a reply to message #869786] |
Fri, 04 May 2012 15:28 |
|
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.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02395 seconds