Skip to content

Commit 83cd8c8

Browse files
committedApr 11, 2017
add hoverlabel attribute container for all traces
- allow arrayOk for all hover label attribute - don't set dflt for bgcolor, bordercolor and font.color as their value depends and the trace color and plot bgcolor
1 parent 00355fb commit 83cd8c8

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
 

‎src/plots/attributes.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
'use strict';
1010

11+
var constants = require('./cartesian/constants');
12+
var fontAttrs = require('./font_attributes');
13+
var extendFlat = require('../lib/extend').extendFlat;
1114

1215
module.exports = {
1316
type: {
@@ -80,6 +83,37 @@ module.exports = {
8083
'But, if `none` is set, click and hover events are still fired.'
8184
].join(' ')
8285
},
86+
hoverlabel: {
87+
bgcolor: {
88+
valType: 'color',
89+
role: 'style',
90+
arrayOk: true,
91+
description: [
92+
'Sets the background color of the hover label.'
93+
].join(' ')
94+
},
95+
bordercolor: {
96+
valType: 'color',
97+
role: 'style',
98+
arrayOk: true,
99+
description: [
100+
'Sets the border color of the hover label.'
101+
].join(' ')
102+
},
103+
font: {
104+
family: extendFlat({}, fontAttrs.family, {
105+
arrayOk: true,
106+
dflt: constants.HOVERFONT
107+
}),
108+
size: extendFlat({}, fontAttrs.size, {
109+
arrayOk: true,
110+
dflt: constants.HOVERFONTSIZE
111+
}),
112+
color: extendFlat({}, fontAttrs.color, {
113+
arrayOk: true
114+
})
115+
}
116+
},
83117
stream: {
84118
token: {
85119
valType: 'string',

‎src/plots/plots.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
811811
// gets overwritten in pie, geo and ternary modules
812812
coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined);
813813

814+
coerce('hoverlabel.bgcolor');
815+
coerce('hoverlabel.bordercolor');
816+
Lib.coerceFont(coerce, 'hoverlabel.font');
817+
814818
// TODO add per-base-plot-module trace defaults step
815819

816820
if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout);

0 commit comments

Comments
 (0)
Please sign in to comment.