LabelOptions
LabelOptions ( seriesIndex ; location ; hOffset ; vOffset ; lowerLimit ; upperLimit )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
seriesIndex | int | -1..10000 | all | |
location | int | 0..9 | (autom.) | |
hOffset | num | -10000..10000 | 0 | Dimension:[pt] |
vOffset | num | -10000..10000 | 0 | Dimension:[pt] |
lowerLimit | num | -inf..+inf | -9e99 | |
upperLimit | num | -inf..+inf | +9e99 |
Examples
LabelOptions(all;centerCenter)
LabelOptions(1;;2;-2)
Description
The LabelOptions() function offers numerous ways to position and finely adjust labels:
• Location of the Labels on Non-Stacked Bar Charts
If enough space is available, the labels are placed by default outside of the bars, otherwise on the inside. Using the argument location, nine positions can be defined on bar charts.
| LABEL_OPTIONS_01 |
1 | OpenDrawing(250;150) |
2 | ChartData(15 25 13 30 25 15) |
3 | |
4 | /* Set up styles. */ |
5 | |
6 | BorderStyle(1;none) |
7 | LabelOptions(1;out) |
8 | /* Set up axes. */ |
9 | |
10 | AxisMajorTicks(all;0) |
11 | /* Set up grid. */ |
12 | MajorGridLineWidths(x;y;0.25) |
13 | MajorGridLineWidths(y;x;0) |
14 |
| LABEL_OPTIONS_02 |
1 | OpenDrawing(250;150) |
2 | ChartData(100 150 280) |
3 | |
4 | /* Set up styles. */ |
5 | |
6 | BorderStyle(1;none) |
7 | ShadowStyle(1;2 2 3) |
8 | LabelTexts(1;"$|u|") |
9 | LabelStyle(1;Verdana;10;bold;white) |
10 | LabelOptions(1;begin) |
11 | /* Set up axes. */ |
12 | ScalingOptions(y;on) /* y-scale top to bottom. */ |
13 | |
14 | AxisMajorTicks(all;0) |
15 | AxisMajorTickLabelTexts(y;"A";"B";"C") |
16 | /* Set up grid. */ |
17 | MajorGridLineWidths(y;x;0.25) |
18 | MajorGridLineWidths(x;y;0) |
19 |
• Location of the Labels on Stacked Charts
On stacked and proportional bar and area charts the labels are placed in the center of each bar or area section by default; the argument location is ignored.
| LABEL_OPTIONS_03 |
1 | OpenDrawing(250;150) |
2 | ChartData(13 17 10 15 15; /* 1st series. */ |
3 | 15 19 17 12 17) /* 2nd series. */ |
4 | |
5 | /* Set up styles. */ |
6 | |
7 | |
8 | |
9 | LabelBackground(all;#fff8;;0) |
10 | /* Set up axes. */ |
11 | |
12 | AxisMajorTicks(all;0) |
13 | /* Set up grid. */ |
14 | MajorGridLineWidths(x;y;0.25) |
15 | MajorGridLineWidths(y;x;0) |
16 |
| LABEL_OPTIONS_04 |
1 | OpenDrawing(250;150) |
2 | ChartData( 4 13 -9; |
3 | 12 -17 0; |
4 | 9 0 21; |
5 | -10 0 -5) |
6 | BarChart(stacked+horizontal+label+shadow;50) |
7 | /* Set up styles. */ |
8 | FillColorScheme(blue) |
9 | FillStyle(4;#c7d52e) |
10 | |
11 | ShadowStyle(all;2 2 3) |
12 | LabelStyle(all;Verdana;10;plain;black) |
13 | LabelStyle(1;Verdana;10;bold;white) |
14 | /* Set up axes. */ |
15 | ScalingOptions(y;on) /* y-scale top to bottom. */ |
16 | |
17 | AxisMajorTicks(all;0) |
18 | AxisMajorTickLabelTexts(y;"A";"B";"C") |
19 | /* Set up grid. */ |
20 | MajorGridLineWidths(y;x;0.25) |
21 | MajorGridLineWidths(x;y;0) |
22 |
| LABEL_OPTIONS_05 |
1 | OpenDrawing(250;150) |
2 | ChartData(5 4 9; /* 1st series. */ |
3 | 3 7 10; /* 2nd series. */ |
4 | 2 2 12) /* 3rd series. */ |
5 | BarChart(proportional+label+shadow;60) |
6 | /* Set up styles. */ |
7 | FillStyle(1;#005ca9) |
8 | FillStyle(2;#00afef) |
9 | FillStyle(3;#cbdb29) |
10 | |
11 | ShadowStyle(all;2 2 3) |
12 | LabelTexts(all;"|||f1|%") |
13 | LabelStyle(all;Verdana;10;bold;white) |
14 | LabelStyle(3;Verdana;10;plain;black) |
15 | /* Set up axes. */ |
16 | |
17 | |
18 | AxisMajorTicks(all;0) |
19 | /* Set up grid. */ |
20 | MajorGridLineWidths(x;y;0.25) |
21 | MajorGridLineWidths(y;x;0) |
22 |
In addition, it is possible to represent either the total sums or the running totals. The drawing and positioning of (running) totals are controlled by the five style functions LabelTexts() , LabelStyle() , LabelBackground() , LabelBackgroundOptions() and LabelOptions() in combination with seriesIndex = –1 (or seriesIndex = stacked). This special series index is available only in the four above-mentioned style functions in combination with stacked or proportional charts. The (running) totals can be placed either outside (default) or on the border of each individual bar or area section. Four constants are available for the argument location. The other usual positioning constants are ignored when seriesIndex = –1 (or seriesIndex = stacked).
| LABEL_OPTIONS_06 |
1 | OpenDrawing(250;150) |
2 | ChartData( 8 13 10; |
3 | 12 17 0; |
4 | 9 8 21; |
5 | 11 10 11) |
6 | |
7 | /* Set up styles. */ |
8 | FillColorScheme(blue) |
9 | FillStyle(4;#c7d52e) |
10 | |
11 | ShadowStyle(all;2 2 3) |
12 | LabelStyle(all;Verdana;10;bold;white) |
13 | LabelStyle(4;Verdana;10;plain;black) |
14 | |
15 | /* Set up axes. */ |
16 | |
17 | |
18 | AxisMajorTicks(all;0) |
19 | AxisMajorTickLabelTexts(x;"A";"B";"C") |
20 | /* Set up grid. */ |
21 | MajorGridLineWidths(x;y;0.25) |
22 | MajorGridLineWidths(y;x;0) |
23 |
| LABEL_OPTIONS_07 |
1 | OpenDrawing(250;150) |
2 | ChartData(13 17 12; /* 1st series. */ |
3 | 18 19 17; /* 2nd series. */ |
4 | 26 25 22) /* 3rd series. */ |
5 | |
6 | /* Set up styles. */ |
7 | FillStyle(1;#2a79b5) |
8 | FillStyle(2;#9cccf0) |
9 | FillStyle(3;#cbdb29) |
10 | |
11 | LabelTexts(1;"") /* Hide labels of 1st series. */ |
12 | LabelStyle(all;Verdana;9) |
13 | LabelStyle(stacked;Verdana;10;plain) |
14 | |
15 | LabelBackground(stacked;#fff8;;0) |
16 | /* Set up axes. */ |
17 | ScalingOptions(y;on) /* y-scale top to bottom. */ |
18 | AxisOptions(x;none) |
19 | |
20 | AxisMajorTicks(y;0) |
21 | AxisMajorTickLabelTexts(y;"A";"B";"C") |
22 | /* Set up grid. */ |
23 | GridLocation(all;none) /* Hide grid. */ |
24 |
If only the total sums or the running totals are to be represented, the "default labels" can be suppressed by entering empty labels LabelTexts(all;"") instead.
| LABEL_OPTIONS_08 |
1 | OpenDrawing(250;150) |
2 | ChartData( 4 13 9; |
3 | 12 15 10; |
4 | 9 10 20; |
5 | 10 8 5) |
6 | BarChart(stacked+horizontal+label+shadow;50) |
7 | /* Set up styles. */ |
8 | FillColorScheme(blue) |
9 | FillStyle(4;#c7d52e) |
10 | |
11 | ShadowStyle(all;2 2 3) |
12 | LabelTexts(all;"") /* Hide labels. */ |
13 | |
14 | LabelBackground(stacked;#fff8;;0) |
15 | /* Set up axes. */ |
16 | ScalingOptions(y;on) /* y-scale top to bottom. */ |
17 | |
18 | AxisMajorTicks(all;0) |
19 | AxisMajorTickLabelTexts(y;"A";"B";"C") |
20 | /* Set up grid. */ |
21 | MajorGridLineWidths(y;x;0.25) |
22 | MajorGridLineWidths(x;y;0) |
23 |
| LABEL_OPTIONS_09 |
1 | OpenDrawing(250;150) |
2 | ChartData( 4 13; |
3 | 12 15; |
4 | 9 11; |
5 | 10 18) |
6 | BarChart(proportional+label+shadow;60) |
7 | /* Set up styles. */ |
8 | FillColorScheme(blue) |
9 | FillStyle(4;#c7d52e) |
10 | |
11 | ShadowStyle(all;2 2 3) |
12 | LabelTexts(all;"") |
13 | LabelStyle(all;Verdana;10;bold;white) |
14 | LabelTexts(stacked;"|2f1|%") |
15 | |
16 | /* Set up axes. */ |
17 | |
18 | |
19 | AxisMajorTicks(all;0) |
20 | AxisMajorTickLabelTexts(x;"A";"B") |
21 | /* Set up grid. */ |
22 | MajorGridLineWidths(x;y;0.25) |
23 | MajorGridLineWidths(y;x;0) |
24 |
| LABEL_OPTIONS_10 |
1 | OpenDrawing(250;150) |
2 | |
3 | ChartData(4 13 5; |
4 | 12 15 10; |
5 | 9 11 12; |
6 | 10 18 10) |
7 | |
8 | /* Set up styles. */ |
9 | FillColorScheme(blue) |
10 | FillStyle(4;#c7d52e) |
11 | |
12 | LabelTexts(all;"") |
13 | LabelTexts(stacked;"|2f1|%") |
14 | LabelBackground(stacked;#fff4;;0;;;2 2 3) |
15 | |
16 | /* Set up axes. */ |
17 | AxisOptions(y;none) /* Hide y-axis. */ |
18 | |
19 | AxisMajorTicks(x;0) |
20 | AxisMajorTickLabelTexts(x;"A";"B";"C") |
21 | /* Set up grid. */ |
22 | GridLocation(all;none) /* Hide grid. */ |
23 | |
24 |
• Location of the Labels on Pie Charts
On pie charts the labels are always located outside of the chart — the argument location is ignored. However, by using the PieChartInnerLabelTexts() and PieChartCenterLabelText() functions it is also possible to position texts inside and in the center of pie charts.
| LABEL_OPTIONS_11 |
1 | OpenDrawing(250;150) |
2 | ChartData(8.9 5.5 3.5 1.4 0.8 0.3) |
3 | |
4 | /* Set up styles. */ |
5 | FillColorScheme(blue;shaded) |
6 | BorderStyle(all;;1.5;white) |
7 | FillStyle(4;#c7d52e) |
8 | ShadowStyle(all;2 2 3) |
9 |
• Location of the Labels on Bubble Charts
As the default, the labels are positioned in the center (location = centerCenter).
| LABEL_OPTIONS_12 |
1 | OpenDrawing(250;150) |
2 | ChartData(7 3 9 18 10 5; /* y-values. */ |
3 | 3 6 9 12 6 5) /* Diameters. */ |
4 | |
5 | /* Set up styles. */ |
6 | |
7 | BorderStyle(1;none) |
8 | ShadowStyle(all;2 2 3) |
9 | LabelStyle(1;Verdana;9;bold;white) |
10 | LabelOptions(1;;;-1) |
11 | /* Set up axes. */ |
12 | |
13 | AxisMajorTicks(all;0) |
14 | /* Set up grid. */ |
15 | MajorGridLineWidths(x;y;0.25) |
16 | MajorGridLineWidths(y;x;0) |
17 |
• Location of the Labels on All Other Charts
As the default, the labels are positioned on the right above the chart points. Using the argument location nine positions can be defined.
| LABEL_OPTIONS_13 |
1 | OpenDrawing(250;150) |
2 | ChartData(1.6 2.5 1.3 3.2 2.8 1.8) |
3 | |
4 | /* Set up styles. */ |
5 | |
6 | ShadowStyle(all;2 2 3) |
7 | LabelBackground(1;white;;0;;;0 0 3) |
8 | |
9 | /* Set up axes. */ |
10 | AxisOptions(y;none) /* Hide y-axis. */ |
11 | |
12 | AxisMajorTicks(x;0) |
13 | AxisMajorTickLabelTexts(x;"A";"B";"C";"D";"E";"F") |
14 | /* Set up grid. */ |
15 | MajorGridLineWidths(y;x;0.25) |
16 | MajorGridLineWidths(x;y;0) |
17 |
As an option, the location of the labels can be finely adjusted by using the arguments hOffset and vOffset. Positive offset values move the labels down to the right, negative values up to the left.
| LABEL_OPTIONS_14 |
1 | OpenDrawing(250;150) |
2 | ChartData(1.5 2.5 1.3 3.2) |
3 | BarChart(label+horizontal+shadow;70) |
4 | /* Set up styles. */ |
5 | |
6 | |
7 | ShadowStyle(all;2 2 3) |
8 | LabelBackground(1;white;;0) |
9 | LabelOptions(1;;3) /* Move 3 pixels right. */ |
10 | /* Set up axes. */ |
11 | |
12 | ScalingOptions(y;on) /* y-scale top to bottom. */ |
13 | |
14 | AxisMajorTicks(all;0) |
15 | AxisMajorTickLabelTexts(y;"A";"B";"C";"D") |
16 | /* Set up grid. */ |
17 | MajorGridLineWidths(y;x;0.25) |
18 | MajorGridLineWidths(x;y;0) |
19 |
On pie charts the arguments hOffset and vOffset are ignored; instead, a radial offset value can be defined by using the PieChartLabelOptions(;outerLabelOffset). A positive offset value increases the space between the border and labels; a negative value decreases the space. The argument outerLabelOffset is to be entered in percent of the segment length.
| LABEL_OPTIONS_15 |
1 | OpenDrawing(250;150) |
2 | ChartData(4.8 3.5 2.5 1.2 0.6 0.2) |
3 | |
4 | PieChartLabelOptions(;8) |
5 | /* Set up styles. */ |
6 | FillColorScheme(blue;shaded) |
7 | FillStyle(4;#c7d52e) |
8 | BorderStyle(all;;1.5;white) |
9 | ShadowStyle(all;2 2 3) |
10 |
With the aid of the arguments lowerLimit and upperLimit the labeling of chart values can be suppressed, i.e. only chart values larger than the lowerLimit and smaller than the upperLimit are labeled. For example, by entering a lower limit the labeling of narrow pie chart segments can be prevented.
| LABEL_OPTIONS_16 |
1 | OpenDrawing(200;200) |
2 | ChartData(500 300 150 62 29 15 7) |
3 | |
4 | PieChartLabelOptions(off;5) /* Use absolute limits in LabelOptions(). */ |
5 | /* Set up styles. */ |
6 | FillColorScheme(blue;shaded) |
7 | FillStyle(4;#c7d52e) |
8 | BorderStyle(all;;1.5;white) |
9 | ShadowStyle(all;2 2 3) |
10 | LabelOptions(1;;0;0;30.0) /* Hide label if value is less than 30. */ |
11 |
On pie charts it is also possible to choose between absolute and relative limits by using the PieChartLabelOptions(useRelativeLimits) function. Relative limits are to be entered in percent of the total sum.
| LABEL_OPTIONS_17 |
1 | OpenDrawing(200;200) |
2 | ChartData(690 220 160 80 40 20 10) |
3 | |
4 | PieChartLabelOptions(on) /* Use relative limits in LabelOptions(). */ |
5 | /* Set up styles. */ |
6 | FillColorScheme(blue;shaded) |
7 | FillStyle(4;#c7d52e) |
8 | BorderStyle(all;;1.5;white) |
9 | ShadowStyle(all;2 2 3) |
10 | LabelOptions(1;;0;0;5.0) /* Hide label if value is less than 5% of the total sum. */ |
11 |