This example demonstrates using CDML and Parameter Substitution and Formatting to include icons in sector labels. It also demonstrates gradient background color, glass shading effect for the title and rounded corners for the chart frame.
- The gradient background color is created using perlchartdir::metalColor, with blue as the base color, and in vertical orientation.
- The rounded frame is configured using BaseChart.setRoundedFrame.
- The glass shading effect of the title is defined using perlchartdir::glassEffect, then applied to the title using Box.setBackground of the title TextBox object.
- The icons file names are added to the chart as an extra field using BaseChart.addExtraField.
- The sector label format string is specified using CDML and Parameter Substitution and Formatting as:
<*block,
valign= absmiddle*><*img= {field0}*> <*block*>{label}<*br*>{percent}%<*/ *><*/ *>
This means that the sector label is a block, which contains an image followed by another text block. The image file is taken from the extra field. The text block contains two lines showing the sector name and percentage.
- The format string is applied to the chart using PieChart.setLabelFormat.