Skip to content

Commit 1eb1c4b

Browse files
committed
When rotate axis label, change text-anchor
1 parent 758875f commit 1eb1c4b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/JSRootPainter.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,7 +2533,7 @@
25332533
for (var l=0;l<hint.lines.length;l++)
25342534
if (hint.lines[l]!==null) {
25352535
var txt = group.append("svg:text")
2536-
.attr("text-anchor", "left")
2536+
.attr("text-anchor", "start")
25372537
.attr("x", wmargin)
25382538
.attr("y", hmargin + l*textheight*hstep)
25392539
.attr("dy", ".8em")
@@ -3603,7 +3603,7 @@
36033603
if (vertical)
36043604
t.attr("x", -labeloffset*side)
36053605
.attr("y", pos)
3606-
.style("text-anchor", (side > 0) ? "end" : "begin")
3606+
.style("text-anchor", (side > 0) ? "end" : "start")
36073607
.style("dominant-baseline", "middle");
36083608
else
36093609
t.attr("x", pos)
@@ -3649,11 +3649,12 @@
36493649

36503650
if ((textscale>0) && (textscale<1.)) {
36513651
// rotate X lables if they are too big
3652-
if ((textscale < 0.7) && !vertical) {
3652+
if ((textscale < 0.7) && !vertical && (side>0)) {
36533653
label_g.selectAll("text").each(function() {
36543654
var txt = d3.select(this), x = txt.attr("x"), y = txt.attr("y");
36553655

36563656
txt.attr("transform", "translate(" + x+ ","+y + ") rotate(20)")
3657+
.style("text-anchor", "start")
36573658
.attr("x",null).attr("y",null);
36583659
});
36593660
textscale*=2;

0 commit comments

Comments
 (0)