Skip to content

Commit 9cebd58

Browse files
committed
Merge pull request #186 from plotly/improve-colorscale-description
Update Descriptions for Colorscale
2 parents 2e59e7a + 00d8559 commit 9cebd58

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/components/colorscale/attributes.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ module.exports = {
3434
colorscale: {
3535
valType: 'colorscale',
3636
role: 'style',
37-
description: 'Sets the colorscale.'
37+
description: [
38+
'Sets the colorscale.',
39+
'The colorscale must be an array containing',
40+
'arrays mapping a normalized value to an',
41+
'rgb, rgba, hex, hsl, hsv, or named color string.',
42+
'At minimum, a mapping for the lowest (0) and highest (1)',
43+
'values are required. For example,',
44+
'`[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.',
45+
'To control the bounds of the colorscale in z space,',
46+
'use zmin and zmax'
47+
].join(' ')
3848
},
3949
autocolorscale: {
4050
valType: 'boolean',

src/traces/scatter/attributes.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,15 @@ module.exports = {
247247
valType: 'colorscale',
248248
role: 'style',
249249
description: [
250-
'Has only an effect if `marker.color` is set to a numerical array.',
251-
'Sets the colorscale.'
250+
'Sets the colorscale.',
251+
'The colorscale must be an array containing',
252+
'arrays mapping a normalized value to an',
253+
'rgb, rgba, hex, hsl, hsv, or named color string.',
254+
'At minimum, a mapping for the lowest (0) and highest (1)',
255+
'values are required. For example,',
256+
'`[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.',
257+
'To control the bounds of the colorscale in color space,',
258+
'use cmin and cmax'
252259
].join(' ')
253260
},
254261
cauto: {

tasks/util/compress_attributes.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ attributeNamesToRemove.forEach(function(attr, i) {
1515
// one line string with or without trailing comma
1616
regexStr += attr + ': \'.*\'' + ',?' + '|';
1717
// array of strings with or without trailing comma
18-
regexStr += attr + ': \\[[\\s\\S]*?\\].*' + ',?';
18+
regexStr += attr + ':.*\\n*.*\\.join\\(\\\'\\s\\\'\\)';
19+
20+
// attr:.*\n.*\.join\(\'\s\'\)
1921

2022
if(i !== attributeNamesToRemove.length-1) regexStr += '|';
2123
});

0 commit comments

Comments
 (0)