LegendColorTones

New in version 5.0

LegendColorTones ( scaleValueMin ;​ scaleValueMax ;​ numOfColorTones ;​ doReverseScale ;​ colorToneGap ;​ labelFormat ;​ borderStroke ;​ borderColor )

Argument Type Range Default Note
scaleValueMin num -inf..+inf (required)
scaleValueMax num -inf..+inf (required)
numOfColorTones int 1..100 (required)
doReverseScale int 0..1 off
colorToneGap num 0..1 1 Relative to color tone size.
labelFormat styt 0..1000 "|u|-|u|" Max. 1000 chars.
borderStroke num[] 0..1000 0
borderColor rgba 0..255 black
Description

The functions LegendColorTones() and LegendColorScale() make it possible to add a legend to heat maps, tree maps and density plots.
The scale values can be overridden by using function LegendTexts() .

LEGEND_COLOR_TONES_01
1

OpenDrawing(400;​150)

2

ChartData(4 2 1 0 1 2 4 7 10 13 16 18 19 18 18 17 15 13 10 8 5 3 2 2 2 3 5 8 10 13 15 17 18 16 16 15 13 12 10)

3

TreeMap()

4

FillColorScale(1;​ 9)

5

BorderStyle(all;​;​1;​#333)

6

LegendStyle(Verdana;​9)

7

LegendOptions(bottomCenter;​

8

0;​ /* Place legend inside of plot area. */

9

0;​ /* Horizontal offset.  */

10

3;​ /* Vertical offset.  */

11

1;​ /* Number of rows (ignored).  */

12

0;​ /* Legend item type (ignored).  */

13

200;​ /* Color scale length.  */

14

15;​ /* Color scale height.  */

15

3;​ /* Gap between text and ticks.  */

16

0;​ /* Row gap (ignored).  */

17

0;​ /* Column gap (ignored).  */

18

bottomCenter) /* Text location.  */

19

LegendColorTones(0;​ /* Scale value Min.  */

20

20;​ /* Scale value Max.  */

21

5;​ /* Number of color tones.  */

22

1;​ /* Do reverse scale.  */

23

1;​ /* Gap between color tones. */

24

"|u|-|u|";​ /* Label format.  */

25

0;​ /* Border stroke.  */

26

black) /* Border color.  */

27

CloseDrawing()

LEGEND_COLOR_TONES_01
LEGEND_COLOR_TONES_02
1

OpenDrawing(560;​120)

2

OpenChart(20;​20;​530;​72;​on)

3

ChartData(null null null 32 24 9 0 27 30 36 26 32 8 5 32 14 27 24 32 4 4 14 20 18 14 27 9 2 23 25 23 18 21 4 1 31 15 23 30 16 2 3 33 31 38 24 28 8 2 21 21 16 11 38 6 3 25 11 33 27 20 4 0 24 27 29 10 25 5 4 32 17 18 39 18 6 3 23 13 23 37 24 6 1 36 34 35 36 18 10 1 25 23 25 24 18 1 2 26 24 40 39 32 7 0 28 13 25 17 15 6 2 11 33 34 12 36 4 3 19 39 21 28 37 2 3 24 24 36 14 40 6 4 15 31 24 35 21 10 3 16 38 10 29 36 3 1 39 26 24 25 27 4 4 37 13 36 38 33 5 3 20 32 33 22 29 3 1 38 12 17 14 20 6 0 37 39 31 30 20 8 1 17 24 23 27 23 2 3 10 30 15 21 25 10 0 34 18 34 17 27 1 4 22 36 15 13 27 8 4 36 19 24 21 27 9 0 13 21 29 35 29 2 3 36 19 11 15 36 5 1 18 18 19 34 38 1 2 33 19 18 34 24 2 1 38 27 22 25 20 4 3 15 39 11 12 20 0 2 18 26 24 34 32 3 4 19 33 37 31 32 3 4 38 18 20 26 34 4 3 20 37 23 12 30 5 1 14 30 39 33 15 2 2 34 11 11 26 28 5 4 19 20 14 34 39 6 1 16 29 11 18 28 8 5 23 13 36 18 19 10 4 34 36 15 35 35 6 2 31 18 13 15 21 7 4 29 24 24 33 13 2 5 27 29 37 17 23 3 5 12 28 22 19 21 5 2 14 37 34 26 18 6 2 33 29 33 24)

4

HeatMap(;​7;​53) /* 7 rows, 53 columns. */

5

HeatMapOptions(0.4%;​;​;​on)

6

/* Set up styles. */

7

FillColorScale(1;​-18;​solid;​0.8;​5)

8

BorderStyle(1;​none) /* Hide borders. */

9

LegendTexts("Less";​;​;​;​"More")

10

LegendStyle(Verdana;​10)

11

LegendOptions(bottomCenter;​

12

0;​ /* Place legend inside of plot area. */

13

0;​ /* Horizontal offset.  */

14

3;​ /* Vertical offset.  */

15

1;​ /* Number of rows (ignored).  */

16

0;​ /* Legend item type (ignored).  */

17

100;​ /* Color scale length.  */

18

10;​ /* Color scale height.  */

19

7;​ /* Gap between text and ticks.  */

20

0;​ /* Row gap (ignored).  */

21

0;​ /* Column gap (ignored).  */

22

4) /* Text location.  */

23

LegendColorTones(0;​ /* Scale value Min.  */

24

40;​ /* Scale value Max.  */

25

5;​ /* Number of color tones.  */

26

0;​ /* Do reverse scale.  */

27

1;​ /* Gap between color tones. */

28

"";​ /* Label format.  */

29

0;​ /* Border stroke.  */

30

black) /* Border color.  */

31

CloseChart()

32

AddText(8;​26;​"M\nT\nW\nT\nF\nS\nS";​Verdana;​9)

33

AddText( 20;​15;​"JAN";​Verdana;​9)

34

AddText( 61;​15;​"FEB";​Verdana;​9)

35

AddText(101;​15;​"MAR";​Verdana;​9)

36

AddText(151;​15;​"APR";​Verdana;​9)

37

AddText(191;​15;​"MAY";​Verdana;​9)

38

AddText(241;​15;​"JUN";​Verdana;​9)

39

AddText(281;​15;​"JUL";​Verdana;​9)

40

AddText(321;​15;​"AUG";​Verdana;​9)

41

AddText(371;​15;​"SEP";​Verdana;​9)

42

AddText(411;​15;​"OCT";​Verdana;​9)

43

AddText(451;​15;​"NOV";​Verdana;​9)

44

AddText(501;​15;​"DEC";​Verdana;​9)

45

CloseDrawing()

LEGEND_COLOR_TONES_02

See also function LegendColorScale() .

Scroll to Top