CDL Basics
CDL is a collection of plain text parameters that describe a chart.
In the most general form, CDL parameters are presented in a name=value
style syntax. Parameter names come
from a defined set of CDL names, such as Background, Header,
DataSet1, and so on. The value consists of one or more attributes.
Attributes are single primitive values that can be combined to form
a complete value for a CDL parameter. For example,
Background = (Color, BorderType, BorderWidth, "ImageURL", ImageFormat, BorderColor);
In the above example, the parameter Background has 6 attributes. Those attributes
are Color, BorderType, BorderWidth, ImageURL, ImageFormat, and BorderColor.
An example of using the Background parameter would be:
Background = (white, RAISED, 2);
The background of the chart would be white with a 2-pixel
raised border.
CDL Statement Types
- Single Value - The parameter attribute is set to a single value.
Example: GraphType = STACKED;
- List Value - The parameter attribute is set to a variable length comma-delimited list:
Example: DataSet1 = 12,40,20,43,59;
- Tuple Value - The parameter attribute is set to a parenthesized list of comma-delimiter values. Each tuple has a fixed maximum number of values.
Example: Header = ("My Header", black, "sansserif", 10);
- Tuple List - A list of tuples.
Example: BubbleSet1 = (10,23,45),(93,23,45),(93,44,53);
- Vtuple - A tuple with a variable number of values.
Example: DialTicLabels = ("dial1","0","2","4","8","10");
CDL Syntax Rules
- Parameter value attributes are separated with a comma.
- Attributes not explicitly set use default values
- String values can be quoted using single or double quotes as long as they are matched.
- Multiple parameters may be on the same line in a file, but all must end with a semicolon.
- A pound sign (#) indicates the start of a comment. All other text on that line is ignored.
- If multiple parameters of the same name are used, the last one received (or at the bottom of the file) takes precedence.
- With the exception of NdsParam parameters, the order of the parameters in a file does not matter.
NdsParam parameters must occur in the file before the Parameter that uses the NDS reference.
CDX Behavior
CDX, also known as dynamic CDL, allows users to change the
contents of CDL just before rendering. When the caller requests a chart (via API or
URL query string), they provide
a list of name-value pairs. For each name in the list, NetCharts Server replaces
all instances of that name in the CDL file with the associated value.
After the replacement, the chart is rendered. CDX variable names
are limited to contiguous alphanumeric text. The variables can be
used to replace one or more CDL parameters, or CDL parameter fragments.