Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix centering multi-line headers in treemap
  • Loading branch information
archmoj committed Mar 14, 2024
commit 2e0440fe0daf841b3921ad2eebdc4126470a9a3a
8 changes: 6 additions & 2 deletions src/traces/treemap/draw_descendants.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@ module.exports = function drawDescendants(gd, cd, entry, slices, opts) {

var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font));

sliceText.text(pt._text || ' ') // use one space character instead of a blank string to avoid jumps during transition

var text = pt._text || ' '; // use one space character instead of a blank string to avoid jumps during transition
var singleLineHeader = isHeader && text.indexOf('<br>') === -1;

sliceText.text(text)
.classed('slicetext', true)
.attr('text-anchor', hasRight ? 'end' : (hasLeft || isHeader) ? 'start' : 'middle')
.attr('text-anchor', hasRight ? 'end' : (hasLeft || singleLineHeader) ? 'start' : 'middle')
.call(Drawing.font, font)
.call(svgTextUtils.convertToTspans, gd);

Expand Down