1010
1111var colorScaleAttributes = require ( './attributes' ) ;
1212var extendDeep = require ( '../../lib/extend' ) . extendDeep ;
13+ var palettes = require ( './scales.js' ) ;
1314
1415module . exports = function makeColorScaleAttributes ( context ) {
1516 return {
@@ -19,7 +20,7 @@ module.exports = function makeColorScaleAttributes(context) {
1920 role : 'style' ,
2021 description : [
2122 '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' ,
2324 ' relative to the max and min values of the array or relative to' ,
2425 ' `cmin` and `cmax` if set.'
2526 ] . join ( '' )
@@ -35,14 +36,19 @@ module.exports = function makeColorScaleAttributes(context) {
3536 ' values are required. For example,' ,
3637 ' `[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.' ,
3738 ' 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 ( ', ' ) )
4043 } ) ,
4144 cauto : extendDeep ( { } , colorScaleAttributes . zauto , {
4245 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.'
4652 ] . join ( '' )
4753 } ) ,
4854 cmax : extendDeep ( { } , colorScaleAttributes . zmax , {
@@ -64,14 +70,18 @@ module.exports = function makeColorScaleAttributes(context) {
6470 autocolorscale : extendDeep ( { } , colorScaleAttributes . autocolorscale , {
6571 description : [
6672 '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.'
6978 ] . join ( '' )
7079 } ) ,
7180 reversescale : extendDeep ( { } , colorScaleAttributes . reversescale , {
7281 description : [
7382 '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).'
7585 ] . join ( '' )
7686 } )
7787 } ;
0 commit comments