TitleOptions
TitleOptions ( location ; placeInside ; hOffset ; vOffset ; vSubTitleOffset ; titleAlignment )
Argument | Type | Range | Default | Note |
---|---|---|---|---|
location | int | 0..9 | topCenter | |
placeInside | int | 0..1 | off | |
hOffset | num | -10000..10000 | 0 | Dimension:[pt] |
vOffset | num | -10000..10000 | 0 | Dimension:[pt] |
vSubTitleOffset | num | -10000..10000 | 2 | Dimension:[pt] |
titleAlignment | int | 1..3 | center |
Examples
TitleOptions(;on;-10)
Description
The TitleOptions() function is used to position and align the title. As the default, the title is positioned in the center at the top of the chart. The 1st argument, location, makes it possible to choose from among nine predefined positions.
| TITLE_OPTIONS_01 |
1 | OpenDrawing(250;150) |
2 | ChartData(26 13 6 3 1) |
3 | BarChart() |
4 | /* Set up styles. */ |
5 | FillStyle(1;#4682b4) |
6 | |
7 | /* Set up axes. */ |
8 | |
9 | AxisMajorTicks(all;0) |
10 | /* Set up title. */ |
11 | TitleText("Diagram-01") |
12 | |
13 | /* Set up grid. */ |
14 | MajorGridLineWidths(x;y;0.25) |
15 | MajorGridLineWidths(y;x;0) |
16 |
In addition, it is also possible to position the title relative to the coordinate origin by using location = 0. The coordinate origin is located in the upper left-hand corner of the drawing or, if the chart is placed within a view, in the upper left-hand corner of the view. Views are explained in Script Structure.
| TITLE_OPTIONS_02 |
1 | OpenDrawing(250;150) |
2 | OpenView(70;30;160;100) |
3 | Background(none;;0.25) /* Add view frame. */ |
4 | ChartData(26 13 6 3 1) |
5 | BarChart() |
6 | /* Set up styles. */ |
7 | FillStyle(1;#4682b4) |
8 | |
9 | /* Set up axes. */ |
10 | |
11 | |
12 | AxisMajorTicks(all;0) |
13 | /* Set up title. */ |
14 | TitleText("Chart 1") |
15 | TitleOptions(0;;;-15) /* Move title 15 pixels up. */ |
16 | /* Set up grid. */ |
17 | MajorGridLineWidths(x;y;0.25) |
18 | MajorGridLineWidths(y;x;0) |
19 | |
20 | Background(none;;0.25) /* Add drawing frame. */ |
21 |
The 2nd argument, placeInside, makes it possible to position the title within the area of the chart.
| TITLE_OPTIONS_03 |
1 | OpenDrawing(250;150) |
2 | ChartData(26 13 6 3 1) |
3 | BarChart() |
4 | /* Set up styles. */ |
5 | FillStyle(1;#4682b4) |
6 | |
7 | /* Set up axes. */ |
8 | |
9 | AxisMajorTicks(all;0) |
10 | /* Set up title. */ |
11 | TitleText("Chart 1") |
12 | TitleBackground(white;;0.25;black) |
13 | |
14 | /* Set up grid. */ |
15 | MajorGridLineWidths(x;y;0.25) |
16 | MajorGridLineWidths(y;x;0) |
17 |
The location of the title can also be finely adjusted by hOffset and vOffset. Positive offset values move the title down to the right, negative values up to the left.
| TITLE_OPTIONS_04 |
1 | OpenDrawing(250;150) |
2 | ChartData(26 13 6 3 1) |
3 | BarChart() |
4 | /* Set up styles. */ |
5 | FillStyle(1;#4682b4) |
6 | |
7 | /* Set up axes. */ |
8 | |
9 | AxisMajorTicks(all;0) |
10 | /* Set up title. */ |
11 | TitleText("Chart 1") |
12 | TitleBackground(white;;2;white;;2 2 3) |
13 | TitleOptions(topCenter;on;3;-2) |
14 | /* Set up grid. */ |
15 | MajorGridLineWidths(x;y;0.25) |
16 | MajorGridLineWidths(y;x;0) |
17 |
The space and alignment between the title and subtitle can be controlled by vSubtitleOffset and titleAlignment. A positive offset value increases the space between the title and subtitle, a negative value decreases the space.
| TITLE_OPTIONS_05 |
1 | OpenDrawing(250;150) |
2 | ChartData(26 13 6 3 1) |
3 | BarChart() |
4 | /* Set up styles. */ |
5 | FillStyle(1;#4682b4) |
6 | |
7 | /* Set up axes. */ |
8 | |
9 | AxisMajorTicks(all;0) |
10 | /* Set up title. */ |
11 | TitleText("Diagram 1";"Series A") |
12 | TitleOptions(topCenter;off;0;0;-1;left) |
13 | /* Set up grid. */ |
14 | MajorGridLineWidths(x;y;0.25) |
15 | MajorGridLineWidths(y;x;0) |
16 |