From 1fda97fd3a35c40f6958cb0275e3385f164572ee Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Fri, 10 Jun 2016 12:50:04 +0200 Subject: [PATCH 1/3] #581 colorspec corrections and clarifications (cherry picked from commit 4d0b2ff) --- src/components/colorscale/color_attributes.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/colorscale/color_attributes.js b/src/components/colorscale/color_attributes.js index 0b22527a2f8..90053007cbc 100644 --- a/src/components/colorscale/color_attributes.js +++ b/src/components/colorscale/color_attributes.js @@ -19,7 +19,7 @@ module.exports = function makeColorScaleAttributes(context) { role: 'style', description: [ 'Sets the ', context, ' color. It accepts either a specific color', - ' or an array of values that are mapped to the colorscale', + ' or an array of numbers that are mapped to the colorscale', ' relative to the max and min values of the array or relative to', ' `cmin` and `cmax` if set.' ].join('') @@ -35,14 +35,19 @@ module.exports = function makeColorScaleAttributes(context) { ' values are required. For example,', ' `[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.', ' To control the bounds of the colorscale in color space,', - ' use `', context, '.cmin` and `', context, '.cmax`.' + ' use `', context, '.cmin` and `', context, '.cmax`.', + ' Alternatively, `colorscale` may be a palette name string', + ' such as `"Viridis"` or `"Greens"`.' ].join('') }), cauto: extendDeep({}, colorScaleAttributes.zauto, { description: [ - 'Has an effect only if `', context, '.color` is set to a numerical array.', - ' Determines the whether or not the color domain is computed', - ' automatically.' + 'Has an effect only if `', context, '.color` is set to a numerical array', + ' and `cmin`, `cmax` are set by the user. In this case,', + ' it controls whether the first/last colors in `colorscale` correspond to', + ' the lowest/highest values in `color` (`cauto: true`), or the `cmin`/`cmax`', + ' values (`cauto: false`).', + ' Defaults to `false` when `cmin`, `cmax` are set by the user.' ].join('') }), cmax: extendDeep({}, colorScaleAttributes.zmax, { @@ -64,14 +69,16 @@ module.exports = function makeColorScaleAttributes(context) { autocolorscale: extendDeep({}, colorScaleAttributes.autocolorscale, { description: [ 'Has an effect only if `', context, '.color` is set to a numerical array.', - ' Determines whether or not the colorscale is picked using', - ' values inside `', context, '.color`.' + ' Determines whether the colorscale is the default palette (`autocolorscale: true`)', + ' or the palette determined by `', context, '.colorscale`.' ].join('') }), reversescale: extendDeep({}, colorScaleAttributes.reversescale, { description: [ 'Has an effect only if `', context, '.color` is set to a numerical array.', - ' Reverses the colorscale.' + ' Reverses the color mapping if true (`cmin` or lowest `color` value will', + ' correspond to the last color and `cmax` or highest `color` value will', + ' correspond to the first color).' ].join('') }) }; From a34c96a1de09e34073d9b45bddfdc23b3a5dd79d Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Fri, 10 Jun 2016 16:44:25 +0200 Subject: [PATCH 2/3] #581 colorspec corrections and clarifications (PR feedback) --- src/components/colorscale/color_attributes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/colorscale/color_attributes.js b/src/components/colorscale/color_attributes.js index 90053007cbc..38225f9c9c3 100644 --- a/src/components/colorscale/color_attributes.js +++ b/src/components/colorscale/color_attributes.js @@ -44,9 +44,9 @@ module.exports = function makeColorScaleAttributes(context) { description: [ 'Has an effect only if `', context, '.color` is set to a numerical array', ' and `cmin`, `cmax` are set by the user. In this case,', - ' it controls whether the first/last colors in `colorscale` correspond to', - ' the lowest/highest values in `color` (`cauto: true`), or the `cmin`/`cmax`', - ' values (`cauto: false`).', + ' it controls whether the color range represented by `colorscale` is mapped to', + ' the value bounds of the `color` array (`cauto: true`), or to the `cmin`..`cmax`', + ' value bounds (`cauto: false`).', ' Defaults to `false` when `cmin`, `cmax` are set by the user.' ].join('') }), From cee831c88a65a51393146bfa5e129841fbd30617 Mon Sep 17 00:00:00 2001 From: Robert Monfera Date: Wed, 15 Jun 2016 16:04:38 +0200 Subject: [PATCH 3/3] #581 colorspec corrections and clarifications (cherry picked from commit a161fa7) --- src/components/colorscale/color_attributes.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/colorscale/color_attributes.js b/src/components/colorscale/color_attributes.js index 38225f9c9c3..68c21984eac 100644 --- a/src/components/colorscale/color_attributes.js +++ b/src/components/colorscale/color_attributes.js @@ -10,6 +10,7 @@ var colorScaleAttributes = require('./attributes'); var extendDeep = require('../../lib/extend').extendDeep; +var palettes = require('./scales.js'); module.exports = function makeColorScaleAttributes(context) { return { @@ -37,16 +38,16 @@ module.exports = function makeColorScaleAttributes(context) { ' To control the bounds of the colorscale in color space,', ' use `', context, '.cmin` and `', context, '.cmax`.', ' Alternatively, `colorscale` may be a palette name string', - ' such as `"Viridis"` or `"Greens"`.' - ].join('') + ' of the following list: ' + ].join('').concat(Object.keys(palettes).join(', ')) }), cauto: extendDeep({}, colorScaleAttributes.zauto, { description: [ 'Has an effect only if `', context, '.color` is set to a numerical array', ' and `cmin`, `cmax` are set by the user. In this case,', - ' it controls whether the color range represented by `colorscale` is mapped to', - ' the value bounds of the `color` array (`cauto: true`), or to the `cmin`..`cmax`', - ' value bounds (`cauto: false`).', + ' it controls whether the range of colors in `colorscale` is mapped to', + ' the range of values in the `color` array (`cauto: true`), or the `cmin`/`cmax`', + ' values (`cauto: false`).', ' Defaults to `false` when `cmin`, `cmax` are set by the user.' ].join('') }), @@ -69,16 +70,18 @@ module.exports = function makeColorScaleAttributes(context) { autocolorscale: extendDeep({}, colorScaleAttributes.autocolorscale, { description: [ 'Has an effect only if `', context, '.color` is set to a numerical array.', - ' Determines whether the colorscale is the default palette (`autocolorscale: true`)', - ' or the palette determined by `', context, '.colorscale`.' + ' Determines whether the colorscale is a default palette (`autocolorscale: true`)', + ' or the palette determined by `', context, '.colorscale`.', + ' In case `colorscale` is unspecified or `autocolorscale` is true, the default ', + ' palette will be chosen according to whether numbers in the `color` array are', + ' all positive, all negative or mixed.' ].join('') }), reversescale: extendDeep({}, colorScaleAttributes.reversescale, { description: [ 'Has an effect only if `', context, '.color` is set to a numerical array.', - ' Reverses the color mapping if true (`cmin` or lowest `color` value will', - ' correspond to the last color and `cmax` or highest `color` value will', - ' correspond to the first color).' + ' Reverses the color mapping if true (`cmin` will correspond to the last color', + ' in the array and `cmax` will correspond to the first color).' ].join('') }) };