Skip to content

Commit b9888bf

Browse files
committed
Improve positioning of Y labels
1 parent a19bc1c commit b9888bf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/JSRootPainter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4874,18 +4874,21 @@
48744874
if (box.height > maxh) maxh = box.height;
48754875
cnt++;
48764876
});
4877+
48774878
if ((cnt>0) && (maxh>0)) {
48784879
// adjust font size
48794880
if (maxh < h/cnt) {
48804881
shift = parseInt((h/cnt - maxh) / 2);
4882+
drawy.selectAll(".tick text").attr("y", -shift).attr("dy", "0");
48814883
} else {
48824884
shift = 1;
48834885
ylabelfont.size = parseInt(ylabelfont.size * (h/cnt-2) / maxh);
48844886
if (ylabelfont.size<2) ylabelfont.size = 2;
48854887
drawy.call(ylabelfont.func);
4888+
drawy.selectAll(".tick text").attr("dy", shift);
48864889
}
48874890
}
4888-
drawy.selectAll(".tick text").attr("dy", shift);
4891+
48894892

48904893
} else
48914894
if ((n2ay > 0) && !this.options.Logy) {

0 commit comments

Comments
 (0)