If you want to have both boundary ticks and marks close to the borders (MaxMin), you can change the source.
In nv.models.axis (), there is a buffer specified when showMaxMin is true for the lower / upper orientation:
if (showMaxMin && (axis.orient() === 'top' || axis.orient() === 'bottom')) { var maxMinRange = []; wrap.selectAll('g.nv-axisMaxMin') .each(function(d,i) { try { if (i) // i== 1, max position maxMinRange.push(scale(d) - this.getBoundingClientRect().width - 4); //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) else // i==0, min position maxMinRange.push(scale(d) + this.getBoundingClientRect().width + 4) }catch (err) { if (i) // i== 1, max position maxMinRange.push(scale(d) - 4); //assuming the max and min labels are as wide as the next tick (with an extra 4 pixels just in case) else // i==0, min position maxMinRange.push(scale(d) + 4); } }); // the g wrapping each tick g.selectAll('g').each(function(d, i) { if (scale(d) < maxMinRange[0] || scale(d) > maxMinRange[1]) { if (d > 1e-10 || d < -1e-10) // accounts for minor floating point errors... though could be problematic if the scale is EXTREMELY SMALL d3.select(this).remove(); else d3.select(this).select('text').remove(); // Don't remove the ZERO line!! } }); }
I just deleted these buffers:
try { if (i) // i== 1, max position maxMinRange.push(scale(d)); else // i==0, min position maxMinRange.push(scale(d)) }catch (err) { if (i) // i== 1, max position maxMinRange.push(scale(d)); else // i==0, min position maxMinRange.push(scale(d)); }
source share