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

Message ListMessage List     Post MessagePost Message

  CDMLTable.getRowHeight() problem
Posted by Nick on Dec-04-2010 08:35
Attachments:
Hello,

I am trying to detect if my labels have wrapped using CDMLTable.getRowHeight(), so that I can flip them vertical if they don't fit.

The problem is that CDMLTable.getRowHeight() seems to return the same value no matter how high ChartDirector expands the row.

Here's the code:

            labelTable.layout();
            int rowheight = labelTable.getRowHeight(0);
            chrtReport.addText(0, 0, rowheight.ToString());

As you can see, in both cases labelTable.getRowHeight(0) returns 40 (right at the upper left corner of the chart). I have also tried using CDMLTable.getCell().getHeight() with the same problem.

Thanks,

Nick
1.png
2.png

  Re: CDMLTable.getRowHeight() problem
Posted by Peter Kwan on Dec-06-2010 18:27
Hi Nick,

Unluckily, currently the CDMLTable.getRowHeight method is not too useful for an axis table created, sized and positioned by ChartDirector.

For axis table, ChartDirector does not really fix the overall width of the table and its cells until either packPlotArea is called or the chat is drawn (using makeChart). It is because the plot area size, axis configuration (such as axis margins), and axis scale are still subjected to change, so ChartDirector would not bother to determine its size.

So the CDMLTable.getRowHeight is currently only useful for free floating table (creating using BaseChart.addTable).

For your case, one method to work around is to call XYChart.packPlotArea twice. It forces ChartDirector to compute the size of the table. After that, CDMLTable.getRowHeight is accurate.

Note: You need to call packPlotArea twice instead of once because of a bug in ChartDirector when using packPlotArea with axis tables. See:

http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&
thread=1277409323#N1277988972

Hope this can help.

Regards
Peter Kwan