LabelStyle
Modified in version 5.0
LabelStyle ( seriesIndex ; font ; size ; style ; color ; alignment ; orientation ; textWidthMax ; textHeightMax ; ellipsisPosition ; shadowEffect ; shadowColor )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
seriesIndex | int | -1..10000 | all | |
font | str | 0..1000 | ApplFont | |
size | num | 0..1000 | 9 | Dimension:[pt] |
style | int | 0..7 | plain | |
color | rgba | 0..255 | black | |
alignment | int | 1..3 | center | |
orientation | num | -360..+360 | 0 | Dimension:[deg] |
textWidthMax | num | -2..10000 | -1 | Dimension:[pt] |
textHeightMax | num | -2..10000 | -1 | Dimension:[pt] |
ellipsisPosition | int | 0..4 | 3 | |
shadowEffect | num[] | -1000..1000 | 0 | |
shadowColor | rgba | 0..255 | #888a |
Examples
LabelStyle(all;;;bold)
LabelStyle(2;Courier;10;plain;gray;center;-45)
Description
By using the LabelStyle() function, labels can be assigned a text style. In doing so, a separate text style can be defined for each data series.
| LABEL_STYLE_01 |
1 | OpenDrawing(250;150) |
2 | ChartData(4.8 3.5 2.5 1.5 0.9 0.2) |
3 | |
4 | /* Set up styles. */ |
5 | FillColorScheme(blue;shaded) |
6 | FillStyle(4;#c7d52e) |
7 | BorderStyle(all;;1.5;white) |
8 | ShadowStyle(all;2 2 3) |
9 | LabelStyle(1;Courier;11;bold;steelBlue) |
10 |
| LABEL_STYLE_02 |
1 | OpenDrawing(250;150) |
2 | ChartData(1.5 2.7 1.3; |
3 | 3.3 1.7 2.3) |
4 | |
5 | /* Set up styles. */ |
6 | FillStyle(1;#4682b4) |
7 | |
8 | |
9 | ShadowStyle(all;2 2 3) |
10 | LabelStyle(1;Verdana;10;plain;#4682b4) |
11 | LabelStyle(2;Verdana;10;plain;crimson) |
12 | LabelBackground(all;#fffd;;0) |
13 | /* Set up axes. */ |
14 | |
15 | AxisMajorTicks(all;0) |
16 | /* Set up grid. */ |
17 | MajorGridLineWidths(x;y;0.25) |
18 | MajorGridLineWidths(y;x;0) |
19 |
By using the argument alignment multi-line texts can either be aligned to the left (alignment = left), in the center (alignment = center) or to the right (alignment = right). As the default, multi-line label texts are formatted flush left.
| LABEL_STYLE_03 |
1 | OpenDrawing(250;150) |
2 | ChartData(135 90 135) |
3 | |
4 | /* Set up styles. */ |
5 | |
6 | |
7 | |
8 | |
9 | ShadowStyle(all;2 2 3) |
10 | LabelTexts(1;"Region A\n|u|\n(|f1|%)";"Region B\n|u|\n(|f1|%)";"Region C\n|u|\n(|f1|%)") |
11 | |
12 |
The 7th argument orientation makes it possible to turn texts in a desired direction. When entering an angle greater than zero, texts are turned clockwise; a negative angle turns them counter-clockwise. All angles are to be entered within a range of ±360 degrees; 0 degrees is horizontal (3 o'clock).
| LABEL_STYLE_04 |
1 | OpenDrawing(250;150) |
2 | ChartData(100 250 180 310 222 123 89 222) |
3 | |
4 | /* Set up styles. */ |
5 | |
6 | |
7 | ShadowStyle(all;2 2 3) |
8 | LabelTexts(1;"|u|") |
9 | LabelStyle(1;Verdana;9;plain;#2c5272;;-90) |
10 | LabelOptions(1;out;0;2) |
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 |
When setting a maximum width (textWidthMax > 0), longer multi-line texts can be issued as continuous text with automatic word wraparound. The height of the text block can be controlled by the argument textHeightMax. Texts which do not completely fit into the area predefined by textWidthMax and textHeightMax will be shortened according to the setting by the argument ellipsisPosition. Five options are available:
ellipsisPosition | Truncation | Ellipsis |
---|---|---|
0 | end | (No ellipsis) |
1 | begin | ...text |
2 | middle | text...text |
3 | end | text... (Default) |
4 | begin + end | ...text... |
| LABEL_STYLE_05 |
1 | OpenDrawing(250;150) |
2 | ChartData(1250 1400) |
3 | BarChart(label+horizontal+shadow;50) |
4 | /* Set up styles. */ |
5 | FillStyle(1;0 0 150 200) |
6 | |
7 | ShadowStyle(all;2 2 3) |
8 | LabelStyle(1;Verdana;10;bold;white;left;;175;30) |
9 | LabelOptions(1;begin) |
10 | LabelTexts(1;"When setting a maximum width longer multi-line texts can be issued as continuous text with automatic word wraparound." ; |
11 | "This has proven advantageous, particularly for Gantt charts such as used for project management and date planners.") |
12 | /* Set up axes. */ |
13 | ScalingOptions(y;on) /* y-scale top to bottom. */ |
14 | |
15 | AxisMajorTicks(all;0) |
16 | AxisMajorTickLabelTexts(y;"A";"B") |
17 | /* Set up grid. */ |
18 | MajorGridLineWidths(y;x;0.25) |
19 | MajorGridLineWidths(x;y;0) |
20 |
| LABEL_STYLE_06 |
1 | OpenDrawing(250;150) |
2 | ChartData(3.23 8.18) |
3 | |
4 | /* Set up styles. */ |
5 | SymbolStyle(1;bullet;8;1;crimson;shaded) |
6 | ShadowStyle(all;2 2 3) |
7 | LabelStyle(1;Verdana;9;bold;#333;left;;100;30;4) |
8 | |
9 | LabelBackground(1;#fff4;;0) |
10 | LabelTexts(1;"When setting a maximum width, longer multi-line texts can be issued as continuous text with automatic word wraparound." ; "The height of the text block can be controlled by the argument textHeightMax.") |
11 | /* Set up axes. */ |
12 | |
13 | AxisMajorTicks(all;0) |
14 | AxisMajorTickLabelTexts(x;"A";"B") |
15 | /* Set up grid. */ |
16 | MajorGridLineWidths(x;y;0.25) |
17 | MajorGridLineWidths(y;x;0) |
18 |
As the default, textWidthMax = –1 and textHeightMax = –1 are set, i.e. no width and height constraints and, thus, no automatic word wraparound support. An additional option is available for bar and Gantt charts. When textWidthMax = –2 and/or textHeightMax = –2, the width and/or height of the bars is used as limitation for the text blocks. This has proven advantageous, particularly for Gantt charts such as used for project management and date planners.
| LABEL_STYLE_07 |
1 | OpenDrawing(250;150) |
2 | ChartData(100) |
3 | BarChart(label+horizontal;100) |
4 | /* Set up styles. */ |
5 | FillStyle(1;255 255 230) |
6 | ShadowStyle(all;2 2 3) |
7 | LabelStyle(1;Verdana;10;plain;black;left;;-2;-2;2) |
8 | LabelTexts(1;"An additional option is available for bar and Gantt charts. When textWidthMax=-2 and/or textHeightMax=-2, the width and/or height of the bars is used as limitation for the text blocks.") |
9 | /* Set up axes. */ |
10 | ScalingOptions(y;on) /* y-scale top to bottom. */ |
11 | |
12 | AxisMajorTicks(all;0) |
13 | AxisMajorTickLabelTexts(y;"A") |
14 | /* Set up grid. */ |
15 | MajorGridLineWidths(y;x;0.25) |
16 | MajorGridLineWidths(x;y;0) |
17 |
| LABEL_STYLE_08 |
1 | OpenDrawing(250;150) |
2 | ChartData(60 160; |
3 | 80 200) |
4 | GanttChart(label+horizontal+shadow;45) |
5 | /* Set up styles. */ |
6 | FillStyle(1;220 253 222) |
7 | FillStyle(2;255 255 230) |
8 | ShadowStyle(all;2 2 3) |
9 | LabelStyle(all;Verdana;10;plain;black;left;-90;-2;-2;3) |
10 | LabelTexts(1;"When setting a maximum width, longer multi-line texts can be issued as continuous text with automatic word wraparound. The height of the text block can be controlled by the argument textHeightMax.") |
11 | LabelTexts(2;"Texts which do not completely fit into the area predefined by textWidthMax and textHeightMax will be shortened according to the setting by the argument ellipsisPosition.") |
12 | /* Set up axes. */ |
13 | |
14 | AxisMajorTicks(all;0) |
15 | /* Set up grid. */ |
16 | MajorGridLineWidths(x;y;0.25) |
17 | MajorGridLineWidths(y;x;0) |
18 |