From 5362176499d20942ea381b516614bedc1d16942d Mon Sep 17 00:00:00 2001 From: lucvic Date: Thu, 19 Nov 2015 10:29:34 +0100 Subject: [PATCH] Text layout fix --- datalets/datasetexplorer-datalet/js/buildtreemap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/datalets/datasetexplorer-datalet/js/buildtreemap.js b/datalets/datasetexplorer-datalet/js/buildtreemap.js index f87bf26..4b39ddf 100755 --- a/datalets/datasetexplorer-datalet/js/buildtreemap.js +++ b/datalets/datasetexplorer-datalet/js/buildtreemap.js @@ -209,7 +209,8 @@ function build(root, place_holder, select_listener) { d.each(function(){ var text = d3.select(this), d = text[0][0].__data__, - words = d.name.trim().split(/\s+|\./).reverse(), + name = d.name.trim(), + words = name.search(/\s+/) >= 0 ? name.split(/\s+/).reverse() : [name], word = words.pop(), line = [word], lineNumber = 0, @@ -232,7 +233,8 @@ function build(root, place_holder, select_listener) { .append("tspan") .attr("x", fx(d.x) + 6) .attr("y", fy(d.y) + 6) - .attr("dy", lineNumber++ * lineHeight + dy + "em"); + .attr("dy", lineNumber++ * lineHeight + dy + "em") + .text(word); var width = fx(d.x + d.dx) - fx(d.x) - 12; var height = fy(d.y + d.dy) - fy(d.y) - 6; -- libgit2 0.21.4