Skip to content

Commit 1816fd2

Browse files
committed
581a switching to parametric descriptions
1 parent 27f62cf commit 1816fd2

File tree

3 files changed

+46
-51
lines changed

3 files changed

+46
-51
lines changed
+44-49
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,92 @@
11
/**
2-
* Copyright 2012-2016, Plotly, Inc.
3-
* All rights reserved.
4-
*
5-
* This source code is licensed under the MIT license found in the
6-
* LICENSE file in the root directory of this source tree.
7-
*/
2+
* Copyright 2012-2016, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
88

99
'use strict';
1010

11-
var scatterAttrs = require('../../traces/scatter/attributes');
12-
13-
var scatterMarkerAttrs = scatterAttrs.marker;
14-
1511
module.exports = function makeColorScaleAttributes(context) {
1612
return {
1713
color: {
1814
valType: 'color',
1915
arrayOk: true,
2016
role: 'style',
2117
description: [
22-
'Sets the marker color. It accepts either a specific color',
23-
'or an array of values that are mapped to the colorscale',
24-
'relative to the max and min values of the array or relative to',
25-
'`cmin` and `cmax` if set.'
26-
].join(' ')
18+
'Sets the ', context, ' color. It accepts either a specific color',
19+
' or an array of values that are mapped to the colorscale',
20+
' relative to the max and min values of the array or relative to',
21+
' `cmin` and `cmax` if set.'
22+
].join('')
2723
},
2824
colorscale: {
2925
valType: 'colorscale',
3026
role: 'style',
3127
description: [
3228
'Sets the colorscale and only has an effect',
33-
'if `marker.color` is set to a numerical array.',
34-
'The colorscale must be an array containing',
35-
'arrays mapping a normalized value to an',
36-
'rgb, rgba, hex, hsl, hsv, or named color string.',
37-
'At minimum, a mapping for the lowest (0) and highest (1)',
38-
'values are required. For example,',
39-
'`[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.',
40-
'To control the bounds of the colorscale in color space,',
41-
'use `marker.cmin` and `marker.cmax`.'
42-
].join(' ')
29+
' if `', context, '.color` is set to a numerical array.',
30+
' The colorscale must be an array containing',
31+
' arrays mapping a normalized value to an',
32+
' rgb, rgba, hex, hsl, hsv, or named color string.',
33+
' At minimum, a mapping for the lowest (0) and highest (1)',
34+
' values are required. For example,',
35+
' `[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.',
36+
' To control the bounds of the colorscale in color space,',
37+
' use `', context, '.cmin` and `', context, '.cmax`.'
38+
].join('')
4339
},
4440
cauto: {
4541
valType: 'boolean',
4642
dflt: true,
4743
role: 'style',
4844
description: [
49-
'Has an effect only if `marker.color` is set to a numerical array.',
50-
'Determines the whether or not the color domain is computed',
51-
'automatically.'
52-
].join(' ')
45+
'Has an effect only if `', context, '.color` is set to a numerical array.',
46+
' Determines the whether or not the color domain is computed',
47+
' automatically.'
48+
].join('')
5349
},
54-
5550
cmax: {
5651
valType: 'number',
5752
dflt: null,
5853
role: 'info',
5954
description: [
60-
'Has an effect only if `marker.color` is set to a numerical array.',
61-
'Sets the upper bound of the color domain.',
62-
'Value should be associated to the `marker.color` array index,',
63-
'and if set, `marker.cmin` must be set as well.'
64-
].join(' ')
55+
'Has an effect only if `', context, '.color` is set to a numerical array.',
56+
' Sets the upper bound of the color domain.',
57+
' Value should be associated to the `', context, '.color` array index,',
58+
' and if set, `', context, '.cmin` must be set as well.'
59+
].join('')
6560
},
6661
cmin: {
6762
valType: 'number',
6863
dflt: null,
6964
role: 'info',
7065
description: [
71-
'Has an effect only if `marker.color` is set to a numerical array.',
72-
'Sets the lower bound of the color domain.',
73-
'Value should be associated to the `marker.color` array index,',
74-
'and if set, `marker.cmax` must be set as well.'
75-
].join(' ')
66+
'Has an effect only if `', context, '.color` is set to a numerical array.',
67+
' Sets the lower bound of the color domain.',
68+
' Value should be associated to the `', context, '.color` array index,',
69+
' and if set, `', context, '.cmax` must be set as well.'
70+
].join('')
7671
},
7772
autocolorscale: {
7873
valType: 'boolean',
7974
dflt: true,
8075
role: 'style',
8176
description: [
82-
'Has an effect only if `marker.color` is set to a numerical array.',
83-
'Determines whether or not the colorscale is picked using',
84-
'values inside `marker.color`.'
85-
].join(' ')
77+
'Has an effect only if `', context, '.color` is set to a numerical array.',
78+
' Determines whether or not the colorscale is picked using',
79+
' values inside `', context, '.color`.'
80+
].join('')
8681
},
8782
reversescale: {
8883
valType: 'boolean',
8984
role: 'style',
9085
dflt: false,
9186
description: [
92-
'Has an effect only if `marker.color` is set to a numerical array.',
93-
'Reverses the colorscale.'
94-
].join(' ')
87+
'Has an effect only if `', context, '.color` is set to a numerical array.',
88+
' Reverses the colorscale.'
89+
].join('')
9590
}
96-
}
97-
}
91+
};
92+
};

src/traces/scatter/attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ module.exports = {
185185
'marker color, or marker line color, whichever is available.'
186186
].join(' ')
187187
},
188-
marker: extendDeep({}, colorAttributes(), {
188+
marker: extendDeep({}, colorAttributes('marker'), {
189189
symbol: {
190190
valType: 'enumerated',
191191
values: Drawing.symbolList,

src/traces/scatter3d/attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module.exports = {
106106
// Currently, `marker` etc. contain mixed attributes (colorAttributes
107107
// and a bunch of others); maybe a future API change could wrap parts
108108
// that belong together, under a `colorspec` or similar attribute name.
109-
marker: extendDeep({}, colorAttributes(), { // Parity with scatter.js?
109+
marker: extendDeep({}, colorAttributes('marker'), { // Parity with scatter.js?
110110
symbol: {
111111
valType: 'enumerated',
112112
values: Object.keys(MARKER_SYMBOLS),

0 commit comments

Comments
 (0)