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

Message ListMessage List     Post MessagePost Message

  MultiChart overlapping problems
Posted by David S. on Mar-22-2012 01:26
When I add two charts to a MultiChart object, whichever chart is added last overlaps the first ignoring transparency.  I set transparency like this in C#:

                wbm.setBackground(0xb19f98);
                wbm.setTransparentColor(0xb19f98);
                wbm.setAntiAlias(true, 1);
                hwbm.setBackground(0xb19f98);
                hwbm.setTransparentColor(0xb19f98);
                hwbm.setAntiAlias(true, 1);
                MultiChart mc = new MultiChart(779, 597);
                mc.setBackground(0xb19f98);
                mc.setTransparentColor(0xb19f98);
                mc.setAntiAlias(true, 1);
                mc.addChart(20, 0, wbm);
                mc.addChart(107, 443, hwbm);

I this circumstance, where the hwbm chart overlaps the wbm chart, the wbm chart doesn't display and there's just a transparent block there (as it's just the background of the hwbm chart).

Is there a way to merge the two charts together overlapping and see both?

Thanks.

  Re: MultiChart overlapping problems
Posted by Peter Kwan on Mar-23-2012 00:07
Hi David,

Within ChartDirector, the transparent color is Chart.Transparent. To create a chart with a transparent background within ChartDirector, use:

XYChart hwbm = new XYChart(myWidth, myHeight, Chart.Transparent);

The setTransparentColor method is used to set the transparency format when the chart is output at an image (PNG, JPG, GIF, BMP, etc). It needs to be set because different  image formats have different types of transparency. JPG and BMP do not support transparency at all (eg. you cannot have a transparent JPG). GIF supports treating one color as fully transparent. PNG supports treating one color as fully transparent, and also supports alpha transparency (that is, there can be different degrees of transparency), which is useful for certain effects such as "soft drop shadow". But some other browsers (eg. IE6) does not support alpha transparency. So the developer would need to decide which type of transparency in the output format, or whether to use transparency at all.

For your case, both the wbm and the hwbm can simply use Chart.Transparent as the background. There is no need to use setTransparentColor as these two charts are not output as images. Instead, the setTransparentColor should be applied to the MultiChart, which is the chart that is actually output as an image.

Hope this can help.

Regards
Peter Kwan

  Re: MultiChart overlapping problems
Posted by David S. on Mar-23-2012 20:25
Thanks Peter.