Skip to content

Commit f20ef2c

Browse files
committed
DRY up trace hoverlabel attrs
... using their layout hoverlabel counterparts
1 parent 636a356 commit f20ef2c

File tree

1 file changed

+10
-34
lines changed

1 file changed

+10
-34
lines changed

src/components/fx/attributes.js

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,25 @@
99
'use strict';
1010

1111
var fontAttrs = require('../../plots/font_attributes');
12+
var hoverLabelAttrs = require('./layout_attributes').hoverlabel;
13+
var extendFlat = require('../../extend').extendFlat;
1214

1315
module.exports = {
1416
hoverlabel: {
15-
bgcolor: {
16-
valType: 'color',
17-
role: 'style',
17+
bgcolor: extendFlat({}, hoverLabelAttrs.bgcolor, {
1818
arrayOk: true,
19-
editType: 'none',
20-
description: [
21-
'Sets the background color of the hover labels for this trace'
22-
].join(' ')
23-
},
24-
bordercolor: {
25-
valType: 'color',
26-
role: 'style',
19+
description: 'Sets the background color of the hover labels for this trace'
20+
}),
21+
bordercolor: extendFlat({}, hoverLabelAttrs.bordercolor, {
2722
arrayOk: true,
28-
editType: 'none',
29-
description: [
30-
'Sets the border color of the hover labels for this trace.'
31-
].join(' ')
32-
},
23+
description: 'Sets the border color of the hover labels for this trace.'
24+
}),
3325
font: fontAttrs({
3426
arrayOk: true,
3527
editType: 'none',
3628
description: 'Sets the font used in hover labels.'
3729
}),
38-
namelength: {
39-
valType: 'integer',
40-
min: -1,
41-
dflt: 15,
42-
arrayOk: true,
43-
role: 'style',
44-
editType: 'none',
45-
description: [
46-
'Sets the length (in number of characters) of the trace name in',
47-
'the hover labels for this trace. -1 shows the whole name',
48-
'regardless of length. 0-3 shows the first 0-3 characters, and',
49-
'an integer >3 will show the whole name if it is less than that',
50-
'many characters, but if it is longer, will truncate to',
51-
'`namelength - 3` characters and add an ellipsis.',
52-
'Note that when `hovertemplate` is set, `namelength` defaults to *-1*.'
53-
].join(' ')
54-
},
55-
editType: 'calc'
30+
namelength: extendFlat({}, hoverLabelAttrs.namelength, {arrayOk: true}),
31+
editType: 'none'
5632
}
5733
};

0 commit comments

Comments
 (0)