d3 / d3-axis

Human-readable reference marks for scales.

Home Page:https://d3js.org/d3-axis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The upper range value should be rounded down.

mbostock opened this issue · comments

Currently I say:

range0 = range[0] + 0.5,
range1 = range[range.length - 1] + 0.5,

But wouldn’t this be better?

range0 = range[0] + 0.5,
range1 = range[range.length - 1] - 0.5,

This is a bad idea because it makes the upper corner of the path domain inconsistent with the last tick, which is often coincident with the end of the path domain. Better is to offset the scale range by one pixel:

x.range([0, width - 1]);