Color Scales

Color scales can be applied to xmCHART heat maps, tree maps and density plots by using the function:

Presently there are 25 built-in color scales to choose from which can be accessed by entering a colorScaleID between 1 and 25. Color scales can be reversed by negating the argument colorScaleID to –colorScaleID. For example:

FillColorScale(1;-17;shaded) /* Available in xmCHART 5 or higher. */

By using the 3rd argument colorVariant, it is possible to choose between the default appearance solid and shaded. For example:

FillColorScale(1;​8)

FillColorScale(1;​8;​shaded)

In addition, the transparency of the colors can be controlled by using the 4th argument opacity. The opacity can be set between 0 (fully transparent) and 1 (completely opaque) — default is 1. For example:

FillColorScale(1;​12;​solid;​0.7)

FillColorScale(1;​12;​shaded;​0.5)

The number of color tones can be limited by using the 5th argument numOfColorTones. For example:

FillColorScale(1;​1;​;​;​7)

In xmCHART 5 three new arguments referenceValueMin, referenceValueMax and referenceValueMid have been added to function FillColorScale(). The arguments referenceValueMin and referenceValueMax are useful for comparing diagrams such as heat maps, tree maps or density plots. By defining a common reference min and max value the color scale is identical for all diagrams and does not depend on the min/max value range of each individual diagram.

The middle of the color scale can be defined by using the argument referenceValueMid. By default the middle is the arithmetic average of the min and max value.

 
Color Scale Palette
 

1 xmCHART 5 or higher required.

 
Examples
EXAMPLE_01
1

OpenDrawing(450;​15)

2

OpenChart(0;​0;​450;​15;​on)

3

ChartData(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30)

4

HeatMap(;​1) /* 1 row. */

5

/* Set up styles. */

6

FillColorScale(1;​17;​solid;​1;​0) /* Scale middle at 15.5 (default) */

7

BorderStyle(1;​none)

8

CloseChart()

9

CloseDrawing()

EXAMPLE_01
EXAMPLE_02
1

OpenDrawing(450;​15)

2

OpenChart(0;​0;​450;​15;​on)

3

ChartData(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30)

4

HeatMap(;​1) /* 1 row. */

5

/* Set up styles. */

6

FillColorScale(1;​17;​solid;​1;​0;;;6) /* Scale middle at 6 */

7

BorderStyle(1;​none)

8

CloseChart()

9

CloseDrawing()

EXAMPLE_02
EXAMPLE_03
1

OpenDrawing(450;​15)

2

OpenChart(0;​0;​450;​15;​on)

3

ChartData(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30)

4

HeatMap(;​1) /* 1 row. */

5

/* Set up styles. */

6

FillColorScale(1;​17;​solid;​1;​0;;;25) /* Scale middle at 25 */

7

BorderStyle(1;​none)

8

CloseChart()

9

CloseDrawing()

EXAMPLE_03
EXAMPLE_04
1

OpenDrawing(450;​15)

2

OpenChart(0;​0;​450;​15;​on)

3

ChartData(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30)

4

HeatMap(;​1) /* 1 row. */

5

/* Set up styles. */

6

FillColorScale(1;​8;​shaded)

7

BorderStyle(1;​none)

8

CloseChart()

9

CloseDrawing()

EXAMPLE_04
EXAMPLE_05
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

/* Set up styles. */

5

FillColorScale(1;​9)

6

CloseDrawing()

EXAMPLE_05
EXAMPLE_06
1

OpenDrawing(560;​100)

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

FillColorScale(1;​15;​solid;​0.8)

7

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

8

CloseChart()

9

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

10

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

11

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

12

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

13

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

14

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

15

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

16

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

17

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

18

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

19

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

20

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

21

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

22

CloseDrawing()

EXAMPLE_06
 

Custom Color Scale

In xmCHART 5 a custom color scale can be defined by adding a list of color stops as the second argument in function FillColorScale(). A color stop is represented by 4 elements: offset, red, green and blue. Offsets are between 0 and 1, the 3 RGB components between 0 and 255 or, as an option, as hexcodes. Colors must be entered without an alpha value.

 
Example
EXAMPLE_07
1

OpenDrawing(360;​18)

2

OpenChart(0;​0;​360;​18;​on)

3

ChartData(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)

4

Heatmap(;​1) /* 1 row. */

5

FillColorScale(1;​ /*  Series index. */

6

0 #67001f

7

0.1 #b2182b

8

0.2 #d6604d

9

0.3 #f4a582

10

0.4 #fddbc7

11

0.5 #f7f7f7

12

0.6 #d1e5f0

13

0.7 #92c5de

14

0.8 #4393c3

15

0.9 #2166ac

16

1 #053061)

17

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

18

CloseChart()

19

CloseDrawing()

EXAMPLE_07
Scroll to Top