Skip to content

Commit dc2f6f4

Browse files
committed
581a dry colors - scatter
1 parent 689a680 commit dc2f6f4

File tree

1 file changed

+8
-160
lines changed

1 file changed

+8
-160
lines changed

src/traces/scatter/attributes.js

Lines changed: 8 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88

99
'use strict';
1010

11+
var colorAttributes = require('../../components/colorscale/color_attributes');
12+
1113
var Drawing = require('../../components/drawing');
1214

1315
var constants = require('./constants');
1416

17+
var extendDeep = require('../../lib/extend').extendDeep;
18+
1519

1620
module.exports = {
1721
x: {
@@ -181,7 +185,7 @@ module.exports = {
181185
'marker color, or marker line color, whichever is available.'
182186
].join(' ')
183187
},
184-
marker: {
188+
marker: extendDeep({}, colorAttributes('marker'), {
185189
symbol: {
186190
valType: 'enumerated',
187191
values: Drawing.symbolList,
@@ -212,17 +216,6 @@ module.exports = {
212216
role: 'style',
213217
description: 'Sets the marker size (in px).'
214218
},
215-
color: {
216-
valType: 'color',
217-
arrayOk: true,
218-
role: 'style',
219-
description: [
220-
'Sets the marker color. It accepts either a specific color',
221-
'or an array of values that are mapped to the colorscale',
222-
'relative to the max and min values of the array or relative to',
223-
'`cmin` and `cmax` if set.'
224-
].join(' ')
225-
},
226219
maxdisplayed: {
227220
valType: 'number',
228221
min: 0,
@@ -264,73 +257,6 @@ module.exports = {
264257
'to pixels.'
265258
].join(' ')
266259
},
267-
colorscale: {
268-
valType: 'colorscale',
269-
role: 'style',
270-
description: [
271-
'Sets the colorscale and only has an effect',
272-
'if `marker.color` is set to a numerical array.',
273-
'The colorscale must be an array containing',
274-
'arrays mapping a normalized value to an',
275-
'rgb, rgba, hex, hsl, hsv, or named color string.',
276-
'At minimum, a mapping for the lowest (0) and highest (1)',
277-
'values are required. For example,',
278-
'`[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.',
279-
'To control the bounds of the colorscale in color space,',
280-
'use `marker.cmin` and `marker.cmax`.'
281-
].join(' ')
282-
},
283-
cauto: {
284-
valType: 'boolean',
285-
dflt: true,
286-
role: 'style',
287-
description: [
288-
'Has an effect only if `marker.color` is set to a numerical array.',
289-
'Determines the whether or not the color domain is computed',
290-
'automatically.'
291-
].join(' ')
292-
},
293-
cmax: {
294-
valType: 'number',
295-
dflt: null,
296-
role: 'info',
297-
description: [
298-
'Has an effect only if `marker.color` is set to a numerical array.',
299-
'Sets the upper bound of the color domain.',
300-
'Value should be associated to the `marker.color` array index,',
301-
'and if set, `marker.cmin` must be set as well.'
302-
].join(' ')
303-
},
304-
cmin: {
305-
valType: 'number',
306-
dflt: null,
307-
role: 'info',
308-
description: [
309-
'Has an effect only if `marker.color` is set to a numerical array.',
310-
'Sets the lower bound of the color domain.',
311-
'Value should be associated to the `marker.color` array index,',
312-
'and if set, `marker.cmax` must be set as well.'
313-
].join(' ')
314-
},
315-
autocolorscale: {
316-
valType: 'boolean',
317-
dflt: true,
318-
role: 'style',
319-
description: [
320-
'Has an effect only if `marker.color` is set to a numerical array.',
321-
'Determines whether or not the colorscale is picked using',
322-
'values inside `marker.color`.'
323-
].join(' ')
324-
},
325-
reversescale: {
326-
valType: 'boolean',
327-
role: 'style',
328-
dflt: false,
329-
description: [
330-
'Has an effect only if `marker.color` is set to a numerical array.',
331-
'Reverses the colorscale.'
332-
].join(' ')
333-
},
334260
showscale: {
335261
valType: 'boolean',
336262
role: 'info',
@@ -340,94 +266,16 @@ module.exports = {
340266
'Determines whether or not a colorbar is displayed.'
341267
].join(' ')
342268
},
343-
line: {
344-
color: {
345-
valType: 'color',
346-
arrayOk: true,
347-
role: 'style',
348-
description: [
349-
'Sets the marker outline color. It accepts either a specific color',
350-
'or an array of values that are mapped to the colorscale',
351-
'relative to the max and min values of the array or relative to',
352-
'`cmin` and `cmax` if set.'
353-
].join(' ')
354-
},
269+
line: extendDeep({}, colorAttributes('marker.line'), {
355270
width: {
356271
valType: 'number',
357272
min: 0,
358273
arrayOk: true,
359274
role: 'style',
360275
description: 'Sets the width (in px) of the lines bounding the marker points.'
361-
},
362-
colorscale: {
363-
valType: 'colorscale',
364-
role: 'style',
365-
description: [
366-
'Sets the colorscale and only has an effect',
367-
'if `marker.line.color` is set to a numerical array.',
368-
'The colorscale must be an array containing',
369-
'arrays mapping a normalized value to an',
370-
'rgb, rgba, hex, hsl, hsv, or named color string.',
371-
'At minimum, a mapping for the lowest (0) and highest (1)',
372-
'values are required. For example,',
373-
'`[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.',
374-
'To control the bounds of the colorscale in color space,',
375-
'use `marker.line.cmin` and `marker.line.cmax`.'
376-
].join(' ')
377-
},
378-
cauto: {
379-
valType: 'boolean',
380-
dflt: true,
381-
role: 'style',
382-
description: [
383-
'Has an effect only if `marker.line.color` is set to a numerical array.',
384-
'Determines the whether or not the color domain is computed',
385-
'with respect to the input data.'
386-
].join(' ')
387-
},
388-
cmax: {
389-
valType: 'number',
390-
dflt: null,
391-
role: 'info',
392-
description: [
393-
'Has an effect only if `marker.line.color` is set to a numerical array.',
394-
'Sets the upper bound of the color domain.',
395-
'Value should be associated to the `marker.line.color` array index,',
396-
'and if set, `marker.line.cmin` must be set as well.'
397-
].join(' ')
398-
},
399-
cmin: {
400-
valType: 'number',
401-
dflt: null,
402-
role: 'info',
403-
description: [
404-
'Has an effect only if `marker.line.color` is set to a numerical array.',
405-
'Sets the lower bound of the color domain.',
406-
'Value should be associated to the `marker.line.color` array index,',
407-
'and if set, `marker.line.cmax` must be set as well.'
408-
].join(' ')
409-
},
410-
autocolorscale: {
411-
valType: 'boolean',
412-
dflt: true,
413-
role: 'style',
414-
description: [
415-
'Has an effect only if `marker.line.color` is set to a numerical array.',
416-
'Determines whether or not the colorscale is picked using',
417-
'the sign of values inside `marker.line.color`.'
418-
].join(' ')
419-
},
420-
reversescale: {
421-
valType: 'boolean',
422-
dflt: false,
423-
role: 'style',
424-
description: [
425-
'Has an effect only if `marker.line.color` is set to a numerical array.',
426-
'Reverses the colorscale.'
427-
].join(' ')
428276
}
429-
}
430-
},
277+
})
278+
}),
431279
textposition: {
432280
valType: 'enumerated',
433281
values: [

0 commit comments

Comments
 (0)