Hi Malcolm,
The BaseChart.getDrawArea obtains the Drawarea object before the chart layers are drawn. It is best to be used to draw things on the background. Only the other hand, BaseChart.makeChart3 method draws the chart and then return the DrawArea object, which you may use to draw over the chart.
In addition to use the DrawArea object, you may also use CDML to load an image. For example, in C#/Java:
ChartDirector.TextBox t = c.addText(40, 60, "<*img=/path/to/aaa.png*>");
t.setMargin(0);
By default, text added using BaseChart.addText will be drawn in front of the chart layers (but you can use Box.setZOrder to change the drawing order). There are also additional CDML attributes in the <*img*> tag to control the width and height of the image (ChartDirector will compress or stretch the image to the specified size).
If you would like to use the DrawArea method, it is like:
DrawArea myImage = new DrawArea();
myImage.loadPNG("/path/to/aaa.png");
c.makeChart3().merge(myImage, 40, 60, Chart.TopLeft, 0);
In all cases, ChartDirector will correctly handle the transparency in loaded GIF/PNG without using setTransparentColor.
(The setTransparentColor is used to control the transparency when you save the chart. Because some image format (such as JPG and BMP) does not support transparency, and some image format (such as GIF) and old browsers (such as IE 6) supports only single color transparency (as opposed to semi-transparency or alpha transparency), so we have a method to control how transparency information is output.)
Hope this can help.
Regards
Peter Kwan |