Commit 5362176499d20942ea381b516614bedc1d16942d
1 parent
d19b8d74
Text layout fix
Showing
1 changed file
with
4 additions
and
2 deletions
datalets/datasetexplorer-datalet/js/buildtreemap.js
... | ... | @@ -209,7 +209,8 @@ function build(root, place_holder, select_listener) { |
209 | 209 | d.each(function(){ |
210 | 210 | var text = d3.select(this), |
211 | 211 | d = text[0][0].__data__, |
212 | - words = d.name.trim().split(/\s+|\./).reverse(), | |
212 | + name = d.name.trim(), | |
213 | + words = name.search(/\s+/) >= 0 ? name.split(/\s+/).reverse() : [name], | |
213 | 214 | word = words.pop(), |
214 | 215 | line = [word], |
215 | 216 | lineNumber = 0, |
... | ... | @@ -232,7 +233,8 @@ function build(root, place_holder, select_listener) { |
232 | 233 | .append("tspan") |
233 | 234 | .attr("x", fx(d.x) + 6) |
234 | 235 | .attr("y", fy(d.y) + 6) |
235 | - .attr("dy", lineNumber++ * lineHeight + dy + "em"); | |
236 | + .attr("dy", lineNumber++ * lineHeight + dy + "em") | |
237 | + .text(word); | |
236 | 238 | var width = fx(d.x + d.dx) - fx(d.x) - 12; |
237 | 239 | var height = fy(d.y + d.dy) - fy(d.y) - 6; |
238 | 240 | ... | ... |