Online Documentation - Statistics - FAQ - Plugin Parts (All, Dependencies) - Class hierarchy
New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1
The list of the topics, classes, interfaces, controls, modules, global methods by category, global methods by name, screenshots, licenses and examples.
Platforms to show: All Mac Windows Linux Cross-Platform
FAQ.ChartDirector: Mark Up Language
Answer: ChartDirector: Mark Up Language
ChartDirector Mark Up Language (CDML) is a language for including formatting information in text strings by marking up the text with tags.
CDML allows a single text string to be rendered using multiple fonts, with different colors, and even embed images in the text.Font Styles
You can change the style of the text by using CDML tags. For example, the line:
<*font=timesi.ttf,size=16,color=FF0000>Hello <*font=arial.ttf,size=12,color=8000*>world!
will result in the following text rendered:
In general, all tags in CDML are enclosed by <* and *>. Attributes within the tags determine the styles of the text following the tags within the same block.
If you want to include <* in text without being interpreted as CDML tags, use <<* as the escape sequence.
The following table describes the supported font style attributes in CDML. See Font Specification for details on various font attributes.
AttributeDescription
font | Starts a new style section, and sets the font name. You may use this attribute without a value (that is, use "font" instead of "font=arial.ttf") to create a new style section without modifying the font name. |
size | The font size. |
width | The font width. This attribute is used to set the font width and height to different values. If the width and height are the same, use the size attribute. |
height | The font height. This attribute is used to set the font width and height to different values. If the width and height are the same, use the size attribute. |
color | The text color in hex format. |
bgColor | The background color of the text in hex format. |
underline | The line width of the line used to underline the following characters. Set to 0 to disable underline. |
sub | Set the following text to be in subscript style. This attribute does not need to have a value. (You may use "sub" as the attribute instead of "sub=1".) |
super | Set the following text to be in superscript style. |
xoffset | Draw the following the text by shifting the text horizontally from the original position by the specified offset in pixels. |
yoffset | Draw the following the text by shifting the text vertically from the original position by the specified offset in pixels. |
advance | Move the cursor forward (to the right) by the number of pixels as specified by the value this attribute. |
advanceTo | Move the cursor forward (to the right) to the position as specified by the value this attribute. The position is specified as the number of pixels to the right of the left border of the block. If the cursor has already passed through the specified position, the cursor is not moved. |
width | The width of the block in pixels. By default, the width is automatically determined to be the width necessary for the contents of the block. If the width attribute is specified, it will be used as the width of the block. If the width is insufficient for the contents, the contents will be wrapped into multiple lines. |
height | The height of the block in pixels. By default, the height is automatically determined to be the height necessary for the contents of the block. If the height attribute is specified, it will be used as the height of the block. |
maxwidth | The maximum width of the block in pixels. If the content is wider than maximum width, it will be wrapped into multiple lines. |
truncate | The maximum number of lines of the block. If the content requires more than the maximum number of lines, it will be truncated. In particular, if truncate is 1, the content will be truncated if it exceeds the maximum width (as specified by maxwidth or width) without wrapping. The last few characters at the truncation point will be replaced with "...". |
linespacing | The spacing between lines as a ratio to the default line spacing. For example, a line spacing of 2 means the line spacing is two times the default line spacing. The default line spacing is the line spacing as specified in the font used. |
bgColor | The background color of the block in hex format. |
valign | The vertical alignment of sub-blocks. This is for blocks that contain sub-blocks. Supported values are baseline, top, bottom, middle and absmiddle. |
halign | The horizontal alignment of lines. This is for blocks that contain multiple lines. Supported values are left, center and right. |
angle | Rotate the content of the block by an angle. The angle is specified in degrees in counter-clockwise direction. |