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

Message ListMessage List     Post MessagePost Message

  CDML table problems with getLeftX and getTopY on cells
Posted by David Salonius on Jan-04-2019 01:43
Attachments:
Hi Peter,

I have followed some suggestions I have found in this forum on creating a custom legend using a CDML table.  I am also using a custom polygon in order to display an index number within a square on a scatterlayer.  Where I am having trouble is trying to get that same custom polygon with the index displayed in my CDML table.  I am trying to use the getLeftX() and getTopY() methods of the cells (TextBoxes) in order to try to overlay the text, but those methods are returning 0.  Even when I call getHeight() on the CDML table and get a valid size, the cell methods are still returning 0.  Any ideas or suggestions?  Thanks.
chart_dir_example.jpg

  Re: CDML table problems with getLeftX and getTopY on cells
Posted by Peter Kwan on Jan-04-2019 22:46
Hi David,

For text in a rectangular box, one method is to put the text in a CDML <*block*>, which can have a border color. It is like:

<*block,halign=center,width=15,height=15,edgeColor=FF0000*><*yoffset=-2*>9<*/*> Some text here.

Hope this can help.

Regards
Peter Kwan

  Re: CDML table problems with getLeftX and getTopY on cells
Posted by David Salonius on Jan-04-2019 23:43
Thank you - yes, that's a better strategy.  The yoffset markup for the index number created problems for a second block I had next to it - caused weird issues with the width.  I ended up separating it into its own column to avoid that.  Unfortunately, it doesn't appear that you can control the edgecolor of the individual sides of the cell.  I was wanting to essentially merge two cells together as far as border lines are concerned.  Is that possible?

  Re: CDML table problems with getLeftX and getTopY on cells
Posted by Peter Kwan on Jan-08-2019 04:01
Attachments:
Hi David,

Is is possible to clarify what is the issue with the second block next to it? May be there are some other methods to achieve the same effect.

I have tried myself, and it seems to be able to produce what is like in your image. I have attached the screen shot of the text layout I got. The CDML I used is:

<*block,valign=top*><*block,halign=center,width=18,height=18,edgeColor=000000,bgColor=FF9999*><*yoffset=-2*>A<*/*>  <*block*>This is a test.nSecond line.<*/*><*/*>

Regards
Peter Kwan
test_image.png

  Re: CDML table problems with getLeftX and getTopY on cells
Posted by Peter Kwan on Jan-08-2019 04:03
Hi David,

The forum software remove the backslash in my original code. The:

This is a test.nSecond line.

should be:

This is a test.\nSecond line.

Regards
Peter Kwan

  Re: CDML table problems with getLeftX and getTopY on cells
Posted by David Salonius on Jan-08-2019 05:05
Attachments:
I reverted back to my single column code and found a syntax error that was giving me the trouble with the widths.  After fixing that, it almost works for my needs but I am still having a problem with the first block (the square with the index number in it) justifying vertically to the bottom.  I have tried all kinds of different ways to set the valign properties of the blocks without success.  In the process, I found that I didn't need to use a y-offset tag as the absmiddle valign of the block puts the index where it should be.  Here's the CDML I'm using and I've attached a screenshot.

<*block*><*block,valign=absmiddle,color=824747B2,edgeColor=FFFFFF,width=20,height=20,halign=center*><*font,size=8*>1<*/*><*/*> <*block,valign=absmiddle,width=120*><*font,size=8,color=FFFFFF*>General Job Info<*/*><*/*><*/*>

Note the main difference between your sample and mine is that you're using a line feed and I'm using the width property of the block to force word wrap automatically.

Honestly, I had accepted the two column approach and learned to live with the additional border - but it would be nice to have this as an alternative if the border is rejected by others.  Thanks for your help.
chart_dir_example3.jpg

  Re: CDML table problems with getLeftX and getTopY on cells
Posted by Peter Kwan on Jan-08-2019 21:28
Attachments:
Hi David,

I have modified your CDML as follows. Below please find the text layout, which I think is similar to what you need.

<*block,valign=top*><*block,valign=absmiddle,color=824747B2,edgeColor=FFFFFF,width=20,height=20,halign=center*><*font,size=8*>1<*/*>  <*block,valign=absmiddle,width=120*><*font,size=8,yoffset=-3,color=444444*>General Job Info This is a test This is a test<*/*><*/*>


Note that in CDML, the <*/*> is for terminating the <*block*>, and the <*/font*> is for terminating the <*font*>. If the block is terminated (with <*/*>), any <*font*> inside the block will automatically terminate. That's why in many case there is no need to enter <*/font*>.

In your original CDML, there are too many <*/*>. I suppose some of them should be <*/font*>. Having too many <*/*> causes the outermost block to be terminated unexpectedly, so the layout is not what you expect.

Also, in CDML, the valign of a block is used to align contents inside the block. It cannot be used to align a block with the next block at the same level. So in your case, the two blocks are not vertically aligned at the middle. To align the two blocks, you would need to apply the valign to the outermost block.

Without the valign, everything is aligned to the "baseline" just like text. A block is treated just like a single character. So in your case, there are two "characters" (the two blocks), and they are aligned at the baseline like text. So they are aligned at the bottom.

In the modified CDML, I aligned the two blocks at the top instead.

Hope this can help.

Regards
Peter Kwan
test_chart2.png

  Re: CDML table problems with getLeftX and getTopY on cells
Posted by David Salonius on Jan-08-2019 21:48
Perfect - thanks for the clarification Peter.