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

Message ListMessage List     Post MessagePost Message

  CDML Table issue
Posted by stefan on May-11-2018 23:29
Attachments:
Hello Peter,

I intend to create a combined version of 'Multi-Stacked Bar Chart' with 'Data Table' under VB6 language.

I managed to populate the 'Multi-Stacked Bar Chart' but I couldn't populate the 'Data Table' below chart according with Graph Structure. As long as the chart is a Stacked one I would like to represent the Stacked categories in the table cells in the same way.

Please find below the Graph updated in accordance with my needs so both categories should be presented in one single cell (in my chart: SAF / Non-SAF). As you can see my workaround was by concatenating 2 strings in one single cell separated by a Pipeline but, of course, this is not an elegant solution.

Could you, please, let me know how can this be done?

Thank you!

Best regards,
Stefan
Multi-Stacked Bar Chart - Data Table.jpg

  Re: CDML Table issue
Posted by Peter Kwan on May-12-2018 21:13
Hi stefan,

Currently, your code put something line "SAF | Non-SAF" in a single cell. The entire text string is center aligned. Because the pipeline is not at the center of the text string, so the pipeline is not center aligned. As a result, the pipeline may not align with that of the cell below it.

May be you can to use CDML to create two equally sized "blocks" contain the "SAF" and "Non-SAF". As the "blocks" are equally sized, so the pipeline in between the block will be at the center and so they will align vertically. It is like:


Call myTable.getStyle().setMargin2(0, 0, 4, 3)

blockWidth = (c.getPlotArea().getWidth() / (UBound(labels) + 1) - 20) / 2
blockTag = "<*block,halign=center,width=" & blockWidth & "*>"

' The text can be divided into two "blocks" like:
text = blockTag & "SAF" & "<*/*>|" & blockTag & "Non-SAF" & "<*/*>"

.... But the text into a cell ....


Regards
Peter Kwan

  Re: CDML Table issue
Posted by stefan on May-14-2018 15:27
Attachments:
Hello Peter,

Thank you for your explanations!

This is very good to know: that we can align the Pipeline along the table.
Only that I am sorry about my emphasyze on pipeline, as this was only an workaround, to get my results put in one single table because I didn't find any example of 'Multi-Stacked Bar Chart' with 'Data Table'.

What I really want to do is to present the Table in a Nested way (2 separated columns for each Day: SAF and Non-SAF) as per picture below.

Thank you for your support!

Best regards,
Stefan
DataTable.jpg

  Re: CDML Table issue
Posted by Peter Kwan on May-15-2018 00:40
Hi stefan,

As ChartDirector is designed as a charting program, not word processing, so its text layout capability is limited.

For your case, you may consider to create the CDMLTable as a standalone table (not docked to the x-axis). This is by using BaseChart.addTable to create the CDMLTable object with 13 columns and 9 rows. For the top row, you can use CDMLTable.setCell to set a cell that spans two columns. This will create the 6 labels on the top row. Then you can fill the cells in the next 8 rows as usual.

After creating the table, you can configure the column width to match the chart. Then you can just put the table under the chart, and you can get the chart you need.

The column width can be configured by using "BaseChart.getColStyle" to get the TextBox representing the column style of a particular column, and call TextBox.setWidth.

The width of the "bar group" on the chart is just the plot area width divided by the number of bar groups. If it is a non-integer, you need to round the width of each column properly into an integer so that the total width of all "bar group" is the plot area width. It means some bar groups can be wider than other bar groups by 1 pixel.

Regards
Peter Kwan

  Re: CDML Table issue
Posted by stefan on May-18-2018 23:49
Hello Peter,

Thank you very much for your support!
It was really useful!

Best regards,
Stefan