| Summary: | runtime change of date/time grouping doesn't work | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Peter Rafaj <peter.rafaj> | ||||||
| Component: | BIRT | Assignee: | Heng Li <liheeng> | ||||||
| Status: | CLOSED WONTFIX | QA Contact: | Xiaoying Gu <bluesoldier> | ||||||
| Severity: | major | ||||||||
| Priority: | P3 | CC: | bluesoldier, liheeng | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Peter Rafaj
Created attachment 174006 [details]
report demonstrating the described issue
Created attachment 174007 [details]
script required to create test table used by test report
RUN-TIME TEST CASE (fails): -run H2 database -run the attached script on H2 database -open the attached report -run the report -you can see that the report doesn't do any grouping on days or hours ... this is wrong behaviour, it should do!!! There is script on the chart which set the grouping during the run-time but this is not applied. DESING-TIME TEST CASE (works fine): -change the date/time grouping manually in the chart to Days -open the chart edit dialog -go to "Select Data" page -press button "Edit group and sorting" (on the right from Category (X) Series field) -the "Group and sorting" dialog is opened -change Unit of grouping to "Days" -confirm the group and sorting dialog -confirm the chart edit dialog -run the report again -now you can see that the grouping works ok Hi Peter,
It is unavailable to change group unit of chart model in chart's render script functions at runtime, because changing group unit of chart model will affect result of data query, but data query is executed before render script functions.
I think you can change group unit of chart model in Report's onPrepare function.
The sample scripts show below, I didn't validate these code, maybe minor error exists, please correct it.
var chartItemHandle = reportContext.getDesignHandle().getElementByID(chartID);
or
var chartItemHandle = reportContext.getDesignHandle().findElement("chart item name");
if ( chartItemHandle instanceof ExtendedItemHandle )
{
var chart = ((ExtendedItemHandle)chartItemHandle).getReportItem().getProperty("chart.instance");
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
var timeUnit = icsc.getExternalContext().getScriptable().getParameterValue("timeUnit")
chart.getAxes().get(0).getSeriesDefinitions().get(0).getGrouping().setGroupingUnit(
GroupingUnitType.getByName(timeUnit)
);
|