10
10
11
11
var colorScaleAttributes = require ( './attributes' ) ;
12
12
var extendDeep = require ( '../../lib/extend' ) . extendDeep ;
13
+ var palettes = require ( './scales.js' ) ;
13
14
14
15
module . exports = function makeColorScaleAttributes ( context ) {
15
16
return {
@@ -19,7 +20,7 @@ module.exports = function makeColorScaleAttributes(context) {
19
20
role : 'style' ,
20
21
description : [
21
22
'Sets the ' , context , ' color. It accepts either a specific color' ,
22
- ' or an array of values that are mapped to the colorscale' ,
23
+ ' or an array of numbers that are mapped to the colorscale' ,
23
24
' relative to the max and min values of the array or relative to' ,
24
25
' `cmin` and `cmax` if set.'
25
26
] . join ( '' )
@@ -35,14 +36,19 @@ module.exports = function makeColorScaleAttributes(context) {
35
36
' values are required. For example,' ,
36
37
' `[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.' ,
37
38
' To control the bounds of the colorscale in color space,' ,
38
- ' use `' , context , '.cmin` and `' , context , '.cmax`.'
39
- ] . join ( '' )
39
+ ' use `' , context , '.cmin` and `' , context , '.cmax`.' ,
40
+ ' Alternatively, `colorscale` may be a palette name string' ,
41
+ ' of the following list: '
42
+ ] . join ( '' ) . concat ( Object . keys ( palettes ) . join ( ', ' ) )
40
43
} ) ,
41
44
cauto : extendDeep ( { } , colorScaleAttributes . zauto , {
42
45
description : [
43
- 'Has an effect only if `' , context , '.color` is set to a numerical array.' ,
44
- ' Determines the whether or not the color domain is computed' ,
45
- ' automatically.'
46
+ 'Has an effect only if `' , context , '.color` is set to a numerical array' ,
47
+ ' and `cmin`, `cmax` are set by the user. In this case,' ,
48
+ ' it controls whether the range of colors in `colorscale` is mapped to' ,
49
+ ' the range of values in the `color` array (`cauto: true`), or the `cmin`/`cmax`' ,
50
+ ' values (`cauto: false`).' ,
51
+ ' Defaults to `false` when `cmin`, `cmax` are set by the user.'
46
52
] . join ( '' )
47
53
} ) ,
48
54
cmax : extendDeep ( { } , colorScaleAttributes . zmax , {
@@ -64,14 +70,18 @@ module.exports = function makeColorScaleAttributes(context) {
64
70
autocolorscale : extendDeep ( { } , colorScaleAttributes . autocolorscale , {
65
71
description : [
66
72
'Has an effect only if `' , context , '.color` is set to a numerical array.' ,
67
- ' Determines whether or not the colorscale is picked using' ,
68
- ' values inside `' , context , '.color`.'
73
+ ' Determines whether the colorscale is a default palette (`autocolorscale: true`)' ,
74
+ ' or the palette determined by `' , context , '.colorscale`.' ,
75
+ ' In case `colorscale` is unspecified or `autocolorscale` is true, the default ' ,
76
+ ' palette will be chosen according to whether numbers in the `color` array are' ,
77
+ ' all positive, all negative or mixed.'
69
78
] . join ( '' )
70
79
} ) ,
71
80
reversescale : extendDeep ( { } , colorScaleAttributes . reversescale , {
72
81
description : [
73
82
'Has an effect only if `' , context , '.color` is set to a numerical array.' ,
74
- ' Reverses the colorscale.'
83
+ ' Reverses the color mapping if true (`cmin` will correspond to the last color' ,
84
+ ' in the array and `cmax` will correspond to the first color).'
75
85
] . join ( '' )
76
86
} )
77
87
} ;
0 commit comments