} catch (ChartException pex) {
pex.printStackTrace();
}
// define the bounds in points
Bounds bo = BoundsImpl.create(0, 0, 800, 600); // in points
// build the rendered chart structure
Generator gr = Generator.instance();
GeneratedChartState gcs = null;
try {
gcs = gr.build(idr.getDisplayServer(), cm, bo, null);
} catch (ChartException gex) {
gex.printStackTrace();
}
// render the chart to a png file
java.awt.Image img = new BufferedImage(
(int) bo.getWidth(), (int) bo.getHeight(), BufferedImage.TYPE_INT_ARGB
);
try {
idr.setProperty(IDeviceRenderer.FILE_IDENTIFIER, file.getRawLocation().toOSString());
try {
gr.render(idr, gcs);