LegendOptions

LegendOptions ( location ;​ placeInside ;​ hOffset ;​ vOffset ;​ distribution ;​ markerType ;​ markerWidth ;​ markerHeight ;​ markerGap ;​ rowGap ;​ columnGap ;​ textLocation ;​ markerShape )

Argument Type Range Default Note
location int 0..9 centerRight
placeInside int 0..1 off
hOffset num -10000..10000 0 Dimension:[pt]
vOffset num -10000..10000 0 Dimension:[pt]
distribution int[] -1..1000 10 See description
markerType int 0..7 automatic
markerWidth num 0..10000 12 Dimension:[pt]
markerHeight num 0..10000 12 Dimension:[pt]
markerGap num -10000..10000 6 Dimension:[pt]
rowGap num -10000..10000 4 Dimension:[pt]
columnGap num -10000..10000 8 Dimension:[pt]
textLocation int 1..9 centerRight
markerShape int 1..3 1 rect,oval,rdRect
Examples

LegendOptions(bottomRight;​on;​;​;​1;​15;​15)

LegendOptions(;​;​;​;​ 2) /* 2 rows (variable number of columns) */

LegendOptions(;​;​;​;​ 2 -1) /* 2 rows (same as above) */

LegendOptions(;​;​;​;​-1 2) /* 2 columns (variable number of rows) */

LegendOptions(;​;​;​;​ 3 -1 1) /* 3 rows with layout column by column. */

LegendOptions(;​;​;​;​-1 1 0 1) /* 1 column, bottom to top. */

Description

The LegendOptions() function provides numerous options for positioning and finely tuning the legend. As the default, the legend is positioned on the right side of the chart. The 1st argument, location, makes it possible to choose from nine predefined positions.

LEGEND_OPTIONS_01
1

OpenDrawing(250;​150)

2

ChartData(1 4;​ 2 3;​ 3 2)

3

BarChart()

4

/* Set up styles. */

5

FillStyle(1;​160 160 160 220)

6

FillStyle(2;​120 120 120 220)

7

FillStyle(3;​200 50 50 220)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

AxisLine(all;​0)

11

AxisMajorTicks(all;​0)

12

/* Set up legend. */

13

LegendTexts("Employee 1 ";​"Employee 2 ";​"Employee 3 ")

14

LegendOptions(centerLeft)

15

/* Set up grid. */

16

MajorGridLineWidths(x;​y;​0.25)

17

MajorGridLineWidths(y;​x;​0)

18

CloseDrawing()

LEGEND_OPTIONS_01

In addition, it is also possible to position the legend 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 there is a view, in the upper left-hand corner of the view. Views are explained in Script Structure. The 2nd argument, placeInside, makes it possible to position the legend within the area of the chart. The location of the legend can also be finely adjusted by hOffset and vOffset. Positive offset values move the legend down to the right, negative values up to the left.

LEGEND_OPTIONS_02
1

OpenDrawing(250;​150)

2

ChartData(9 2;​ 4 1;​ 2 2)

3

BarChart()

4

/* Set up styles. */

5

FillStyle(1;​160 160 160 220)

6

FillStyle(2;​120 120 120 220)

7

FillStyle(3;​200 50 50 220)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

AxisLine(all;​0)

11

AxisMajorTicks(all;​0)

12

/* Set up legend. */

13

LegendTexts("Employee 1";​"Employee 2";​"Employee 3")

14

LegendOptions(topRight;​on;​3;​-3)

15

/* Set up grid. */

16

MajorGridLineWidths(x;​y;​0.25)

17

MajorGridLineWidths(y;​x;​0)

18

CloseDrawing()

LEGEND_OPTIONS_02

The layout of the legend texts can be designed in a wide variety of ways using the argument distribution. The argument distribution can consist of up to 6 elements which are separated by spaces, tabs or line feeds.

Element Description Range Default  
[1] Number of rows -1..1000 10 (-1...variable number of rows)
[2] Number of columns -1..1000 -1 (-1...variable number of columns)
[3] Arrange column by column 0..1 0  
[4] Arrange reversed 0..1 0  
[5] Equidistant column widths 0..1 0  
[6] Equidistant row heights 0..1 0  
LEGEND_OPTIONS_03
1

OpenDrawing(250;​150)

2

ChartData(1 4;​ 2 3;​ 3 2)

3

BarChart()

4

/* Set up styles. */

5

FillStyle(1;​160 160 160 220)

6

FillStyle(2;​120 120 120 220)

7

FillStyle(3;​200 50 50 220)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

AxisLine(all;​0)

11

AxisMajorTicks(all;​0)

12

/* Set up legend. */

13

LegendTexts("Employee 1";​"Employee 2";​"Employee 3")

14

LegendOptions(bottomCenter;​;​;​;​2) /* Arrange in 2 rows. */

15

/* Set up grid. */

16

MajorGridLineWidths(x;​y;​0.25)

17

MajorGridLineWidths(y;​x;​0)

18

CloseDrawing()

LEGEND_OPTIONS_03
LEGEND_OPTIONS_04
1

OpenDrawing(250;​150)

2

ChartData(1 4;​ 2 3;​ 3 2)

3

BarChart()

4

/* Set up styles. */

5

FillStyle(1;​160 160 160 220)

6

FillStyle(2;​120 120 120 220)

7

FillStyle(3;​200 50 50 220)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

AxisLine(all;​0)

11

AxisMajorTicks(all;​0)

12

/* Set up legend. */

13

LegendTexts("Employee 1";​"Employee 2";​"Employee 3")

14

LegendOptions(bottomCenter;​;​;​;​2 -1 1) /* Arrange in 2 rows column by column. */

15

/* Set up grid. */

16

MajorGridLineWidths(x;​y;​0.25)

17

MajorGridLineWidths(y;​x;​0)

18

CloseDrawing()

LEGEND_OPTIONS_04
LEGEND_OPTIONS_05
1

OpenDrawing(250;​150)

2

ChartData(1;​ 4;​ 3)

3

BarChart(horizontal)

4

/* Set up styles. */

5

FillStyle(1;​160 160 160 220)

6

FillStyle(2;​120 120 120 220)

7

FillStyle(3;​200 50 50 220)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

AxisLine(all;​0)

11

AxisMajorTicks(all;​0)

12

/* Set up legend. */

13

LegendTexts("Employee 1 ";​"Employee 2 ";​"Employee 3 ")

14

LegendOptions(centerLeft;​;​;​-8;​

15

-1 1 1 1;​ /* Arrange reversed, column by column. */

16

;​;​;​;​12)

17

/* Set up grid. */

18

MajorGridLineWidths(x;​y;​0)

19

MajorGridLineWidths(y;​x;​0.25)

20

CloseDrawing()

LEGEND_OPTIONS_05

The argument markerType serves to define the legend symbols. It is also possible to combine rectangle, line and chart symbols simultaneously. If no marker type is defined, an appropriate type is automatically chosen, e.g. a square for bar and pie charts and a line combined with a symbol for line charts with symbols.

LEGEND_OPTIONS_06
1

OpenDrawing(250;​150)

2

ChartData(3 3.5 3;​ 1 1.5 1)

3

LineChart(symbol)

4

/* Set up styles. */

5

LineStyle(1;​poly;​1.5;​121 190 51)

6

LineStyle(2;​poly;​1.5;​ 48 89 195)

7

SymbolStyle(1;​circle;​6;​1;​121 190 51;​;​white)

8

SymbolStyle(2;​circle;​6;​1;​ 48 89 195;​;​white)

9

/* Set up axes. */

10

Scaling(y;​linear;​0;​4;​2)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up legend. */

14

LegendTexts("Series 1";​"Series 2")

15

LegendOptions(bottomCenter;​;​;​;​1;​rect)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseDrawing()

LEGEND_OPTIONS_06
LEGEND_OPTIONS_07
1

OpenDrawing(250;​150)

2

ChartData(3 3.5 3;​ 1 1.5 1)

3

LineChart(symbol)

4

/* Set up styles. */

5

LineStyle(1;​poly;​1.5;​121 190 51)

6

LineStyle(2;​poly;​1.5;​ 48 89 195)

7

SymbolStyle(1;​circle;​6;​1;​121 190 51;​;​white)

8

SymbolStyle(2;​circle;​6;​1;​ 48 89 195;​;​white)

9

/* Set up axes. */

10

Scaling(y;​linear;​0;​4;​2)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up legend. */

14

LegendTexts("Series 1";​"Series 2")

15

LegendOptions(bottomCenter;​;​;​;​1;​line)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseDrawing()

LEGEND_OPTIONS_07
LEGEND_OPTIONS_08
1

OpenDrawing(250;​150)

2

ChartData(3 3.5 3;​ 1 1.5 1)

3

LineChart(symbol)

4

/* Set up styles. */

5

LineStyle(1;​poly;​1.5;​121 190 51)

6

LineStyle(2;​poly;​1.5;​ 48 89 195)

7

SymbolStyle(1;​circle;​6;​1;​121 190 51;​;​white)

8

SymbolStyle(2;​circle;​6;​1;​ 48 89 195;​;​white)

9

/* Set up axes. */

10

Scaling(y;​linear;​0;​4;​2)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up legend. */

14

LegendTexts("Series 1";​"Series 2")

15

LegendOptions(bottomCenter;​;​;​;​1;​line+symbol)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseDrawing()

LEGEND_OPTIONS_08
LEGEND_OPTIONS_09
1

OpenDrawing(250;​150)

2

ChartData(3 3.5 3;​ 1 1.5 1)

3

LineChart(symbol)

4

/* Set up styles. */

5

LineStyle(1;​poly;​1.5;​121 190 51)

6

LineStyle(2;​poly;​1.5;​ 48 89 195)

7

SymbolStyle(1;​circle;​6;​1;​121 190 51;​;​white)

8

SymbolStyle(2;​circle;​6;​1;​ 48 89 195;​;​white)

9

/* Set up axes. */

10

Scaling(y;​linear;​0;​4;​2)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up legend. */

14

LegendTexts("Series 1";​"Series 2")

15

LegendOptions(bottomCenter;​;​;​;​1;​line+symbol;​20)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseDrawing()

LEGEND_OPTIONS_09

The arguments, markerWidth, markerHeight, markerGap, rowGap and columnGap, control the size of the legend symbol, the space between the legend symbol and legend text as well as the space between the legend texts.

LEGEND_OPTIONS_10
1

OpenDrawing(250;​150)

2

ChartData(1 4;​ 2 3;​ 3 2)

3

BarChart()

4

/* Set up styles. */

5

FillStyle(1;​160 160 160 220)

6

FillStyle(2;​120 120 120 220)

7

FillStyle(3;​200 50 50 220)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

Scaling(y;​linear;​0;​4;​4)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up legend. */

14

LegendTexts("Employee 1";​"Employee 2";​"Employee 3")

15

LegendOptions(;​;​;​;​;​;​8;​8;​10;​20)

16

/* Set up grid. */

17

MajorGridLineWidths(x;​y;​0.25)

18

MajorGridLineWidths(y;​x;​0)

19

CloseDrawing()

LEGEND_OPTIONS_10

By using the argument textLocation, the layout of the legend text can be controlled in relation to the legend symbol. Nine positions are available for this. As the default, legend texts are positioned to the right of the legend symbol (textLocation = centerRight).

LEGEND_OPTIONS_11
1

OpenDrawing(250;​150)

2

ChartData(1 4;​ 2 3;​ 3 2)

3

BarChart()

4

/* Set up styles. */

5

FillStyle(1;​160 160 160 220)

6

FillStyle(2;​120 120 120 220)

7

FillStyle(3;​200 50 50 220)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

Scaling(y;​linear;​0;​4;​4)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up legend. */

14

LegendTexts("Employee 1";​"Employee 2";​"Employee 3")

15

LegendOptions(;​;​;​;​;​;​

16

8;​8;​ /* Symbol size. */

17

5;​ /* Gap between symbol and text. */

18

12;​;​ /* Row gap. */

19

topCenter)

20

/* Set up grid. */

21

MajorGridLineWidths(x;​y;​0.25)

22

MajorGridLineWidths(y;​x;​0)

23

CloseDrawing()

LEGEND_OPTIONS_11
LEGEND_OPTIONS_12
1

OpenDrawing(250;​150)

2

ChartData(3 3.5 3;​ 1 1.5 1)

3

LineChart(symbol)

4

/* Set up styles. */

5

LineStyle(1;​poly;​1.0;​121 190 51)

6

LineStyle(2;​poly;​1.0;​ 48 89 195)

7

SymbolStyle(1;​bullet;​5;​1;​121 190 51;​shaded)

8

SymbolStyle(2;​bullet;​5;​1;​ 48 89 195;​shaded)

9

/* Set up axes. */

10

Scaling(y;​linear;​0;​4;​2)

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up legend. */

14

LegendTexts("Series 1";​"Series 2")

15

LegendOptions(bottomCenter;​;​;​;​

16

1;​ /* Number of rows. */

17

line+symbol;​

18

24;​12;​ /* Symbol size. */

19

4;​ /* Gap between symbol and text. */

20

0;​60;​ /* Row and column gaps. */

21

bottomCenter)

22

/* Set up grid. */

23

MajorGridLineWidths(x;​y;​0.25)

24

MajorGridLineWidths(y;​x;​0)

25

CloseDrawing()

LEGEND_OPTIONS_12

The argument markerShape serves to define the shape of the legend markers. As the default, the marker shape is rectangular (markerShape =​ 1). In addition, round marker shapes (markerShape =​ 2) and rounded rectangular shapes (markerShape =​ 3) are available.

LEGEND_OPTIONS_13
1

OpenDrawing(250;​150)

2

ChartData(100 50 15)

3

PieChart()

4

/* Set up styles. */

5

FillStyle(1;​#00a79d;​shaded)

6

FillStyle(2;​#f81a53;​shaded)

7

FillStyle(3;​#063e9e;​shaded)

8

BorderStyle(all;​none)

9

/* Set up legend. */

10

LegendTexts("Series 1";​"Series 2")

11

LegendOptions(centerRight;​;​

12

0;​0;​ /* hOffset and vOffset. */

13

-1 1;​ /* Number of rows and columns. */

14

automatic;​ /* Marker type. */

15

14;​14;​ /* Symbol size. */

16

5;​ /* Gap between symbol and text. */

17

10;​40;​ /* Gap between rows and columns. */

18

bottomCenter;​ /* Location of legend text. */

19

2) /* Marker shape. */

20

CloseDrawing()

LEGEND_OPTIONS_13
Scroll to Top