BIRT runtime dynamic chart scaling
Hi, I'm writting a composite report engine that allows users to select some reports and render them as one, merging all HTML outputs for each sub-report in the same HTML file, reducing charts size. The issue is how to resize charts before rendering the sub-report without lossing image quality.
I tried something like this:
ReportDesignHandle reportHandle = (ReportDesignHandle) runnable.getDesignHandle();
ReportItemHandle handle = (ReportItemHandle) reportHandle.findElement("NewChart");
handle.setWidth("6in");
handle.setHeight("4in");
But the generated image output has a sensible loss of quality.
Does anybody know another way?
I tried something like this:
ReportDesignHandle reportHandle = (ReportDesignHandle) runnable.getDesignHandle();
ReportItemHandle handle = (ReportItemHandle) reportHandle.findElement("NewChart");
handle.setWidth("6in");
handle.setHeight("4in");
But the generated image output has a sensible loss of quality.
Does anybody know another way?
0
Comments
-
Hi, I have solved this problem by my self. For example, this code resizes the chart to a half:
ReportDesignHandle reportHandle = (ReportDesignHandle) runnable.getDesignHandle();
ReportItemHandle handle = (ReportItemHandle) reportHandle.findElement("NewChart");
ExtendedItemHandle eHandle = (ExtendedItemHandle) handle;
ChartWithAxes chart = (ChartWithAxes) eHandle.getReportItem().getProperty("chart.instance");
double oldWidth = chart.getBlock().getBounds().getWidth();
double oldHeight = chart.getBlock().getBounds().getHeight();
chart.getBlock().getBounds().setWidth(oldWidth / 2);
chart.getBlock().getBounds().setHeight(oldHeight / 2);
handle.setWidth(handle.getWidth().getMeasure() / 2);
handle.setHeight(handle.getHeight().getMeasure() / 2);
Note that you also need to resize all the parent elements of the chart (for example grid cells) and the property bounds is only neccesary (and avaliable) in charts.0
Categories
- All Categories
- 107 Developer Announcements
- 53 Articles
- 106 General Questions
- 142 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 76 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 118 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management