| Summary: | Change chart size dynamically | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | maria baldassarri <mbaldass> | ||||
| Component: | BIRT | Assignee: | Yulin Wang <Lionel.wyl> | ||||
| Status: | VERIFIED WORKSFORME | QA Contact: | Maggie Shen <lshen> | ||||
| Severity: | enhancement | ||||||
| Priority: | P3 | CC: | acc-clps, hchristensen, jerlich, sbouchet | ||||
| Version: | 2.1.2 | Keywords: | plan | ||||
| Target Milestone: | 2.5.0 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
maria baldassarri
Created attachment 72137 [details]
Design file example
Hi, I ran into the same issue. According to bug #159970, i can set the size of my chart on the 'beforeFactory' event, but i can't use any dataset result to set the size dynamically. Cheers, Stéphane I suggest to use an auto-adaptive size in such scenarios. The goal is to have a consistent bar width for all the charts coming from the same chart design, in repeater controls such as tables and crosstabs (in the future). I think this only make sense for chart with category axes. In such case, we could compute the max number of categories to show, and use the chart width as the base size, then compute the size of other charts by checking the ratio of the categories vs the max one. We have to experiment to check if only the plot should be resized or the whole chart (which would result in legends being misaligned). We could add adaptive size support for chart in tables, just like chart in xtab. However, we should add some limitations for chart, so the chart can align itself to the horizontal labels. For instance, chart should be with axes, flipped, no legend, not chart title, and so on. We should add a property in model and UI to enable adaptive size, since this behavior is optional. Meanwhile, this property is disabled until all prerequisites are satisfied. Since it will result in model and UI change, and we are in 2.3 RC period, it should be fixed in next release. I don't understand why the adaptative size cannot work with legend or title? I need to be able to set the whole chart size dynamically according to the submitted parameters.. For example with a pie chart with lots of columns, the pie itself my show fine but the legend is clipped.. Can't something be done to make the whole chart size configurable dynamically ? Any update? (In reply to comment #5) > I don't understand why the adaptative size cannot work with legend or title? > I need to be able to set the whole chart size dynamically according to the > submitted parameters.. > For example with a pie chart with lots of columns, the pie itself my show fine > but the legend is clipped.. > Can't something be done to make the whole chart size configurable dynamically ? > There are two solutions for this issue. The first one is to let user set chart size by scripting. The final size computation will be done by user. The second one is to let user set a base size such as bar width, just like the comment#3. This solution has many limitation just like the comment#4. Which one could resolve your issue? I think currently chart supports dynamic size change by script. However user should compute size in script.
Please write script like this:
function beforeGeneration( chart, icsc )
{
// Get Y series definition. This is a sample for Bar chart.
var ySD = chart.getPrimaryOrthogonalAxis(chart.getPrimaryBaseAxes()[0]).getSeriesDefinitions().get(0);
// Get data point count
var count = ySD.getRunTimeSeries().get(0).getDataSet().getValues().length;
// Compute width and set it to chart block. Here we suppose bar width is 50 and legend width is 100
chart.getBlock().getBounds().setWidth(50*count+100);
}
You could take this example to compute size by yourself.
Tried the given script, the chart size can be set dynamically. Set the bug as verified. |