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

Message ListMessage List     Post MessagePost Message

  Unable to control layer level of Chart.addText()
Posted by Mark on Dec-09-2011 02:12
Attachments:
(Using Java)  I have a background image already on my plot (as a watermark), but I want
to add a different small icon in the corner.  I can do this successfully using CDML and the
chart.addText() method.  However, I cannot seem to control the layer in which it appears.
The icon always appears on top of the layers, hiding elements underneath, regardless if I
use addText() near the beginning of my code or near the bottom before calling
MakeChart().  (See the red/white/blue icon in the uploaded graphic.)

What I want is the opposite behavior, where all other elements (traces, semi-
transparent zones, marks, gridlines, etc.) can partially hide my icon. Is this possible??

My watermark behaves this way, where other elements of my plot cover the watermark
image, and I want the same sort of behavior with my little icon.  So what strategy do I
need to accomplish this?

Mark
MTZI3_HGIRGZZr.png

  Re: Unable to control layer level of Chart.addText()
Posted by Peter Kwan on Dec-10-2011 02:06
Hi Mark,

You can use Box.setZOrder to control the z-order of the TextBox. For example:

ChartDirector.TextBox t = myChartObj.addText(.............);
//position at the back of the plot area
t.setZOrder(Chart.PlotAreaZ);

Hope this can help.

Regards
Peter Kwan

  Re: Unable to control layer level of Chart.addText()
Posted by Mark on Dec-13-2011 03:47
Thanks for pointing me in the right direction.  However, exploiting your code example does
not change anything.  If I use Chart.PlotAreaZ as the argument to setZOrder(), my
text/icon appear, but on top of everything (as if I had specified Chart.ChartFrontZ).  If I try
any other number, like Chart.ChartBackZ, the text/icon do not appear at all.

I'm not sure what I am doing improperly.  I've tried moving the addText() and setZOrder()
portion of the code to several places, including: immediately after the creation of the plot
area; and right after the plotArea.setBackground2(); and near the end just prior to
makeChart().  Nothing makes a difference.

Any other ideas?

  Re: Unable to control layer level of Chart.addText()
Posted by Peter Kwan on Dec-13-2011 08:50
Hi Mark,

Your chart consists of 3 BaseChart objects - the top XYChart, the bottom XYChart, and a MultiChart that contains the two XYChart objects. Would you mind to clarify to which BaseChart have you added the logo to?

For your case, the logo should be added to the top XYChart object, not the MultiChart object. (The "myChartObj" in the code I suggest should refer to the top XYChart object, not the MultiChart object.) Also, the BaseChart.addText should be call before makeChart. For safety, you may call it immediately after you have called addPlotArea.

Please kindly let me know if the above can solve the problem.

Regards
Peter Kwan

  Re: Unable to control layer level of Chart.addText()
Posted by Mark on Dec-13-2011 10:32
Attachments:
Ah, yes!  Once I added text [addText()] to the top xy-chart instead of the multi-chart, the
text/icon showed up beneath the layers I wanted, except for one.  The zone that is shaded
with a semi-transparent brown still shows behind the icon.  See attached graphic.  Anything
I can do about this??

Mark
MYVK2_HGIRGZZr.png

  Re: Unable to control layer level of Chart.addText()
Posted by Peter Kwan on Dec-14-2011 02:11
Hi Mark,

Currently, your logo image has a white background. I suggest you can change it to a transparent background (you can do it with PhotoShop or many other graphics editing tools). In this way, it will not block the zone.

If you do not have the necessary tool to change the background to transparent, you may email your logo image to me. I can change it for you. My email is pkwan@advsofteng.net.

Hope this can help.

Regards
Peter Kwan