ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Transparent Background
Posted by Brian Maring on Aug-14-2009 10:22
Hi Peter,

I am coding in PHP and would like to create charts with transparent backgrounds so that I
can copy them onto a .doc file with a colored background and without having the white
background go on top of the color.

How would I do this?  Does it depend on the browser/output file type?

Thanks,
Brian

  Re: Transparent Background
Posted by Peter Kwan on Aug-14-2009 22:51
Hi Brian,

ChartDirector fully supports transparent backgrounds. However, note that your browser (or whatever tools you want to view the image) can support transparent backgrounds too.

For example, IE 6 cannot support true color PNG images with transparent backgrounds (but IE 7 can). All browsers can support GIF transparency, but GIF only supports 256 colors (not true colors). None of the browsers can support JPEG transparency, because the JPEG standard does not support transparency.

Because some browsers and viewing devices do not support true color transparency, and ChartDirector by default uses true color images (not 256 colors), so ChartDirector by default will disable transparency in the output to ensure compatibility with all browsers and viewing devices.

You may use BaseChart.setTransparentColor to ask ChartDirector to enable transparent output. You may refer to the documentation on BaseChart.setTransparentColor for details.

For example:

#true color transparency for PNG
$c->setTransparentColor(-1);

or

#256-color tranpsarency for GIF and palette based PNG
#use white 0xffffff to mean transparent
$c->setTransparentColor(0xffffff);

Hope this can help.

Regards
Peter Kwan