8000 add 'hovertext' attr to all traces that support hover 'text' · afvca/plotly.js@0842b6c · GitHub
[go: up one dir, main page]

Skip to content

Commit 0842b6c

Browse files
committed
add 'hovertext' attr to all traces that support hover 'text'
- where 'hovertext' has priority over 'text'
1 parent 8229e62 commit 0842b6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+326
-14
lines changed

src/traces/barpolar/attributes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ module.exports = {
5858
'this trace\'s coordinates.'
5959
].join(' ')
6060
}),
61-
// hovertext: barAttrs.hovertext,
61+
hovertext: extendFlat({}, barAttrs.hovertext, {
62+
description: 'Same as `text`.'
63+
}),
6264

6365
// textposition: {},
6466
// textfont: {},

src/traces/barpolar/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3333
coerce('width');
3434

3535
coerce('text');
36+
coerce('hovertext');
3637
coerce('hovertemplate');
37-
// coerce('hovertext');
3838

3939
// var textPosition = coerce('textposition');
4040
// var hasBoth = Array.isArray(textPosition) || textPosition === 'auto';

src/traces/box/attributes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ module.exports = {
7272
'To be seen, trace `hoverinfo` must contain a *text* flag.'
7373
].join(' ')
7474
}),
75+
hovertext: extendFlat({}, scatterAttrs.hovertext, {
76+
description: 'Same as `text`.'
77+
}),
7578
whiskerwidth: {
7679
valType: 'number',
7780
min: 0,

src/traces/box/calc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ function initNestedArray(len) {
212212

213213
function arraysToCalcdata(pt, trace, i) {
214214
var trace2calc = {
215-
text: 'tx'
215+
text: 'tx',
216+
hovertext: 'htx'
216217
};
217218

218219
for(var k in trace2calc) {

src/traces/box/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function handlePointsDefaults(traceIn, traceOut, coerce, opts) {
100100
coerce('unselected.marker.size');
101101

102102
coerce('text');
103+
coerce('hovertext');
103104
} else {
104105
delete traceOut.marker;
105106
}

src/traces/candlestick/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = {
5050
decreasing: directionAttrs(OHLCattrs.decreasing.line.color.dflt),
5151

5252
text: OHLCattrs.text,
53+
hovertext: OHLCattrs.hovertext,
5354
whiskerwidth: extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }),
5455

5556
hoverlabel: OHLCattrs.hoverlabel,

src/traces/candlestick/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3131
handleDirection(traceIn, traceOut, coerce, 'decreasing');
3232

3333
coerce('text');
34+
coerce('hovertext');
3435
coerce('whiskerwidth');
3536

3637
layout._requestRangeslider[traceOut.xaxis] = true;

src/traces/choropleth/attributes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ module.exports = extendFlat({
3636
text: extendFlat({}, scatterGeoAttrs.text, {
3737
description: 'Sets the text elements associated with each location.'
3838
}),
39+
hovertext: extendFlat({}, scatterGeoAttrs.hovertext, {
40+
description: 'Same as `text`.'
41+
}),
3942
marker: {
4043
line: {
4144
color: scatterGeoMarkerLineAttrs.color,

src/traces/choropleth/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3030
coerce('locationmode');
3131

3232
coerce('text');
33+
coerce('hovertext');
3334
coerce('hovertemplate');
3435

3536
coerce('marker.line.color');

src/traces/cone/attributes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ var attrs = {
159159
'these elements will be seen in the hover labels.'
160160
].join(' ')
161161
},
162+
hovertext: {
163+
valType: 'string',
164+
role: 'info',
165+
dflt: '',
166+
arrayOk: true,
167+
editType: 'calc',
168+
description: 'Same as `text`.'
169+
},
162170
hovertemplate: hovertemplateAttrs({editType: 'calc'}, {keys: ['norm']})
163171
};
164172

0 commit comments

Comments
 (0)
0