Skip to content

Commit 088b0e0

Browse files
committed
revert sunburst hoverinfo defaults
also applied the same defaults for treemap fix pointer to entry in hover clean up unused keys and variables
1 parent f3d38b8 commit 088b0e0

File tree

7 files changed

+15
-54
lines changed

7 files changed

+15
-54
lines changed

src/traces/sunburst/attributes.js

+3-19
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ module.exports = {
159159
'current path',
160160
'percent root',
161161
'percent visible',
162-
'percent parent',
163-
'root label',
164-
'visible label',
165-
'parent label'
162+
'percent parent'
166163
],
167164
extras: ['none'],
168165
editType: 'plot',
@@ -186,22 +183,9 @@ module.exports = {
186183
'current path',
187184
'percent root',
188185
'percent visible',
189-
'percent parent',
190-
'root label',
191-
'visible label',
192-
'parent label'
186+
'percent parent'
193187
],
194-
dflt: [
195-
'label',
196-
'text',
197-
'value',
198-
'percent root',
199-
'percent visible',
200-
'percent parent',
201-
'root label',
202-
'visible label',
203-
'parent label'
204-
].join('+')
188+
dflt: 'label+text+value+name'
205189
}),
206190
hovertemplate: hovertemplateAttrs({}, {
207191
keys: constants.eventDataKeys

src/traces/sunburst/plot.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function plotOne(gd, cd, element, transitionOpts) {
231231
}
232232

233233
sliceTop
234-
.call(exports.attachFxHandlers, gd, cd, styleOne, constants)
234+
.call(exports.attachFxHandlers, entry, gd, cd, styleOne, constants)
235235
.call(helpers.setSliceCursor, gd, {isTransitioning: gd._transitioning});
236236

237237
slicePath.call(styleOne, pt, trace);
@@ -251,7 +251,7 @@ function plotOne(gd, cd, element, transitionOpts) {
251251

252252
// position the text relative to the slice
253253
var textBB = Drawing.bBox(sliceText.node());
254-
pt.transform = transformInsideText(textBB, pt, cd0, styleOne);
254+
pt.transform = transformInsideText(textBB, pt, cd0);
255255
pt.translateX = transTextX(pt);
256256
pt.translateY = transTextY(pt);
257257

@@ -500,7 +500,7 @@ function makeEventData(pt, trace) {
500500
return out;
501501
}
502502

503-
exports.attachFxHandlers = function(sliceTop, gd, cd, styleOne, constants) {
503+
exports.attachFxHandlers = function(sliceTop, entry, gd, cd, styleOne, constants) {
504504
var cd0 = cd[0];
505505
var trace = cd0.trace;
506506
var hierarchy = cd0.hierarchy;
@@ -595,7 +595,7 @@ exports.attachFxHandlers = function(sliceTop, gd, cd, styleOne, constants) {
595595
}
596596
}
597597

598-
var ref1 = hierarchy;
598+
var ref1 = entry;
599599
if(ref1 && getVal(ref1)) {
600600
hoverPt.percentVisible = pt.percentVisible = val / getVal(ref1);
601601
hoverPt.visibleLabel = pt.visibleLabel = helpers.getLabelString(ref1.data.data.label);

src/traces/treemap/attributes.js

-23
Original file line numberDiff line numberDiff line change
@@ -272,27 +272,4 @@ module.exports = {
272272
},
273273

274274
domain: domainAttrs({name: 'treemap', trace: true, editType: 'calc'}),
275-
276-
_hovered: {
277-
marker: {
278-
line: {
279-
color: extendFlat({}, pieAttrs.marker.line.color, {
280-
description: [
281-
'Sets the color of the line',
282-
'enclosing each sector when it is hovered'
283-
].join(' ')
284-
}),
285-
width: extendFlat({}, pieAttrs.marker.line.width, {
286-
description: [
287-
'Sets the width (in px) of the line',
288-
'enclosing each sector when it is hovered.'
289-
].join(' ')
290-
}),
291-
editType: 'style'
292-
},
293-
294-
editType: 'style'
295-
},
296-
editType: 'style'
297-
}
298275
};

src/traces/treemap/draw_ancestors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ module.exports = function drawAncestors(gd, cd, entry, slices, opts) {
116116
}
117117

118118
sliceTop
119-
.call(attachFxHandlers, gd, cd, styleOne, constants)
119+
.call(attachFxHandlers, entry, gd, cd, styleOne, constants)
120120
.call(helpers.setSliceCursor, gd, { isTransitioning: gd._transitioning });
121121

122122
slicePath.call(styleOne, pt, trace);

src/traces/treemap/draw_descendants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ module.exports = function drawDescendants(gd, cd, entry, slices, opts) {
118118
}
119119

120120
sliceTop
121-
.call(attachFxHandlers, gd, cd, styleOne, constants)
121+
.call(attachFxHandlers, entry, gd, cd, styleOne, constants)
122122
.call(helpers.setSliceCursor, gd, { isTransitioning: gd._transitioning });
123123

124124
slicePath.call(styleOne, pt, trace);

test/jasmine/tests/sunburst_test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ describe('Test sunburst hover:', function() {
345345
pos: 2,
346346
exp: {
347347
label: {
348-
nums: 'Seth\n33.3% of Eve',
348+
nums: 'Seth',
349349
},
350350
ptData: {
351351
curveNumber: 0,
@@ -360,7 +360,7 @@ describe('Test sunburst hover:', function() {
360360
pos: 3,
361361
exp: {
362362
label: {
363-
nums: 'Cain\n16.7% of Eve\nA',
363+
nums: 'Cain\nA',
364364
},
365365
ptData: {
366366
curveNumber: 0,
@@ -1179,7 +1179,7 @@ describe('Test sunburst interactions edge cases', function() {
11791179
})
11801180
.then(hover(gd, 4))
11811181
.then(function() {
1182-
assertHoverLabelContent({ nums: 'D\n4\n26.7% of C\n14.3% of A\n0' });
1182+
assertHoverLabelContent({ nums: 'D\n4\n0' });
11831183
})
11841184
.then(done);
11851185
});

test/jasmine/tests/treemap_test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ describe('Test treemap hover:', function() {
344344
pos: 2,
345345
exp: {
346346
label: {
347-
nums: 'Seth\n33.3% of Eve',
347+
nums: 'Seth',
348348
},
349349
ptData: {
350350
curveNumber: 0,
@@ -359,7 +359,7 @@ describe('Test treemap hover:', function() {
359359
pos: 3,
360360
exp: {
361361
label: {
362-
nums: 'Cain\n16.7% of Eve\nA',
362+
nums: 'Cain\nA',
363363
},
364364
ptData: {
365365
curveNumber: 0,
@@ -971,7 +971,7 @@ describe('Test treemap interactions edge cases', function() {
971971
})
972972
.then(hover(gd, 4))
973973
.then(function() {
974-
assertHoverLabelContent({ nums: 'D\n4\n26.7% of C\n14.3% of A\n0' });
974+
assertHoverLabelContent({ nums: 'D\n4\n0' });
975975
})
976976
.then(done);
977977
});

0 commit comments

Comments
 (0)