Skip to content

Commit db87e62

Browse files
committed
(hover|text)template: pie/funnel/waterfall fix attribute definition
1 parent 6780a3d commit db87e62

File tree

5 files changed

+79
-4
lines changed

5 files changed

+79
-4
lines changed

Diff for: src/traces/funnel/attributes.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727

2828
hovertext: barAttrs.hovertext,
2929
hovertemplate: hovertemplateAttrs({}, {
30-
keys: constants.eventDataKeys.concat(['label', 'value', 'text'])
30+
keys: constants.eventDataKeys
3131
}),
3232

3333
hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
@@ -47,8 +47,9 @@ module.exports = {
4747
'are computed separately (per trace).'
4848
].join(' ')
4949
},
50+
// TODO: incorporate `label` and `value` in the eventData
5051
texttemplate: texttemplateAttrs({editType: 'plot'}, {
51-
keys: constants.eventDataKeys.concat(['label', 'value', 'text'])
52+
keys: constants.eventDataKeys.concat(['label', 'value'])
5253
}),
5354

5455
text: barAttrs.text,

Diff for: src/traces/pie/attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module.exports = {
106106

107107
text: {
108108
valType: 'data_array',
109-
editType: 'calc',
109+
editType: 'plot',
110110
description: [
111111
'Sets text elements associated with each sector.',
112112
'If trace `textinfo` contains a *text* flag, these elements will be seen',

Diff for: src/traces/waterfall/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ module.exports = {
9999
'are computed separately (per trace).'
100100
].join(' ')
101101
},
102+
// TODO: incorporate `label` and `value` in the eventData
102103
texttemplate: texttemplateAttrs({editType: 'plot'}, {
103-
keys: ['label', 'text', 'initial', 'delta', 'final']
104+
keys: constants.eventDataKeys.concat(['label'])
104105
}),
105106
text: barAttrs.text,
106107
textposition: barAttrs.textposition,
38 KB
Loading
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"data": [{
3+
"type": "waterfall",
4+
"x": [
5+
"2010-01-01",
6+
"2010-07-01",
7+
"2011-01-01",
8+
"2012-01-01"
9+
],
10+
"y": [1, -2, 3, 0],
11+
"textinfo": "label",
12+
"textposition": "inside"
13+
}, {
14+
"type": "waterfall",
15+
"x": [
16+
"2010-01-01",
17+
"2010-07-01",
18+
"2011-01-01",
19+
"2012-01-01"
20+
],
21+
"y": [1, -2, 3, 0],
22+
"texttemplate": "%{label}",
23+
"textposition": "inside",
24+
"xaxis": "x1",
25+
"yaxis": "y1"
26+
}, {
27+
"type": "funnel",
28+
"orientation": "v",
29+
"x": [
30+
"2010-01-01",
31+
"2010-07-01",
32+
"2011-01-01",
33+
"2012-01-01"
34+
],
35+
"y": [10, 7, 3, 0],
36+
"textinfo": "label",
37+
"textposition": "inside",
38+
"xaxis": "x2",
39+
"yaxis": "y2"
40+
}, {
41+
"type": "funnel",
42+
"orientation": "v",
43+
"x": [
44+
"2010-01-01",
45+
"2010-07-01",
46+
"2011-01-01",
47+
"2012-01-01"
48+
],
49+
"y": [10, 7, 3, 0],
50+
"texttemplate": "%{label}",
51+
"textposition": "inside",
52+
"xaxis": "x2",
53+
"yaxis": "y2"
54+
}],
55+
"layout": {
56+
"title": {
57+
"text": "textinfo: 'label' versus texttemplate: '%{label}'"
58+
},
59+
"xaxis": {
60+
"type": "date"
61+
},
62+
"margin": {"t": 40, "b": 20, "l": 20, "r": 20},
63+
"width": 800,
64+
"height": 400,
65+
"grid": {
66+
"rows": 1,
67+
"columns": 2,
68+
"pattern": "independent",
69+
"xgap": 5,
70+
"ygap": 5
71+
}
72+
}
73+
}

0 commit comments

Comments
 (0)