PieChartLabelOptions
Modified in version 5.0
PieChartLabelOptions ( useRelativeLimits ; outerLabelOffset ; innerLabelOffset ; optimizeLabelTextColor )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
useRelativeLimits | int | 0..1 | off | |
outerLabelOffset | num | -100..100 | 0 | In % of pie radius |
innerLabelOffset | num | -100..100 | 0 | In % of pie radius |
optimizeLabelTextColor | int | 0..1 | off | xmCHART 5.0.5 or higher required |
Examples
Description
The 1st argument useRelativeLimits makes it possible to define relative limits instead of absolute limits. Chart values, which do not lie within these limits, are not labeled. The limits, i.e. the lower and upper limit, are defined in the LabelOptions() function. By using the arguments outerLabelOffset and innerLabelOffset, the space between the border and the outer and inner labels can be controlled.
xmCHART 4+ comes with an additional flag for the 3rd argument innerLabelOffset: By attaching 1 to innerLabelOffset the offset is the distance between the border of the pie chart and the center of the inner label texts, in opposite to the distance between the border of the pie chart and the outer edge of the inner label texts (default).
| PIE_CHART_LABEL_OPTIONS_01 |
1 | OpenDrawing(280;280) |
2 | |
3 | ChartData(100 80 40 30 10) |
4 | |
5 | /* Set up styles. */ |
6 | |
7 | PieChartLabelOptions(;;25 1) |
8 | PieChartInnerLabelTexts("Project 1\n[|u|]"; |
9 | "Project 2\n[|u|]"; |
10 | "Project 3\n[|u|]"; |
11 | "Project 4\n[|u|]"; |
12 | "Project 5\n[|u|]") |
13 | PieChartInnerLabelStyle(Verdana;9;bold;white;center) |
14 | |
15 | ShadowStyle(all;2 2 3) |
16 | |
17 |
By activating the argument optimizeLabelTextColor = on the inner label text color is automatically adjusted to ensure good readability.
| PIE_CHART_LABEL_OPTIONS_02 |
1 | /* Regular inner label text color: BLACK (#333333) */ |
2 | OpenDrawing(460;220) |
3 | |
4 | ChartData(100 75 50 25) |
5 | |
6 | PieChartLabelOptions(on;5;20;off) /* Don't optimize label text color. */ |
7 | PieChartInnerLabelTexts("|u|") /* Show absolute values. */ |
8 | PieChartInnerLabelStyle(Verdana;10;plain;#333333) |
9 | /* Set up styles. */ |
10 | |
11 | |
12 | |
13 | |
14 | BorderStyle(all;;1.5;white) |
15 | ShadowStyle(all;2 2 3) |
16 | LabelTexts(1;"|||f1|%") /* Show relative values. */ |
17 | LabelStyle(1;Verdana;10;plain;#333333) |
18 | |
19 | |
20 | ChartData(100 75 50 25) |
21 | |
22 | PieChartLabelOptions(on;5;20;on) /* Optimize label text color. */ |
23 | PieChartInnerLabelTexts("|u|") /* Show absolute values. */ |
24 | PieChartInnerLabelStyle(Verdana;10;plain;#333333) |
25 | /* Set up styles. */ |
26 | |
27 | |
28 | |
29 | |
30 | BorderStyle(all;;1.5;white) |
31 | ShadowStyle(all;2 2 3) |
32 | LabelTexts(1;"|||f1|%") /* Show relative values. */ |
33 | LabelStyle(1;Verdana;10;plain;#333333) |
34 | |
35 |
| PIE_CHART_LABEL_OPTIONS_03 |
1 | /* Regular inner label text color: WHITE (#f5f5f5) */ |
2 | OpenDrawing(460;220) |
3 | |
4 | ChartData(100 75 50 25) |
5 | |
6 | PieChartLabelOptions(on;5;20;off) /* Don't optimize label text color. */ |
7 | PieChartInnerLabelTexts("|u|") /* Show absolute values. */ |
8 | PieChartInnerLabelStyle(Verdana;10;bold;#f5f5f5) |
9 | /* Set up styles. */ |
10 | |
11 | |
12 | |
13 | |
14 | BorderStyle(all;;1.5;white) |
15 | ShadowStyle(all;2 2 3) |
16 | LabelTexts(1;"|||f1|%") /* Show relative values. */ |
17 | LabelStyle(1;Verdana;10;plain;#333) |
18 | |
19 | |
20 | ChartData(100 75 50 25) |
21 | |
22 | PieChartLabelOptions(on;5;20;on) /* Optimize label text color. */ |
23 | PieChartInnerLabelTexts("|u|") /* Show absolute values. */ |
24 | PieChartInnerLabelStyle(Verdana;10;bold;#f5f5f5) |
25 | /* Set up styles. */ |
26 | |
27 | |
28 | |
29 | |
30 | BorderStyle(all;;1.5;white) |
31 | ShadowStyle(all;2 2 3) |
32 | LabelTexts(1;"|||f1|%") /* Show relative values. */ |
33 | LabelStyle(1;Verdana;10;plain;#333) |
34 | |
35 |
See also functions BarChartOptions() and GanttChartOptions() .