Skip to content

Commit 3cb2910

Browse files
committed
align minor ticks
1 parent cd96c12 commit 3cb2910

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

src/plots/cartesian/axes.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,11 +991,11 @@ axes.calcTicks = function calcTicks(ax, opts) {
991991
}
992992

993993
if(hasMinor) {
994-
var canOverlap =
994+
ax._inOutTicksCanOverlap =
995995
(ax.minor.ticks === 'inside' && ax.ticks === 'outside') ||
996996
(ax.minor.ticks === 'outside' && ax.ticks === 'inside');
997997

998-
if(!canOverlap) {
998+
if(!ax._inOutTicksCanOverlap) {
999999
// remove duplicate minors
10001000

10011001
var majorValues = tickVals.map(function(d) { return d.value; });
@@ -2855,6 +2855,9 @@ axes.makeTickPath = function(ax, shift, sgn, opts) {
28552855
var len = opts.len !== undefined ? opts.len :
28562856
minor ? ax.minor.ticklen : ax.ticklen;
28572857

2858+
// move one pixel so that minor ticks reach major ticks
2859+
if(minor && ax._inOutTicksCanOverlap) shift += 0.5;
2860+
28582861
var axLetter = ax._id.charAt(0);
28592862
var pad = (ax.linewidth || 1) / 2;
28602863

test/image/baselines/17.png

460 Bytes
Loading
398 Bytes
Loading
895 Bytes
Loading

0 commit comments

Comments
 (0)