Commit a0b1552d authored by Mike Malamud's avatar Mike Malamud

Fix for issue #860, Recalculate tickSize on updates

parent 1262aa39
...@@ -1244,14 +1244,22 @@ ...@@ -1244,14 +1244,22 @@
if (!axis.tickGenerator) { if (!axis.tickGenerator) {
var maxDec = opts.tickDecimals; axis.tickGenerator = function (axis) {
var dec = -Math.floor(Math.log(axis.delta) / Math.LN10); var maxDec = opts.tickDecimals,
dec = -Math.floor(Math.log(axis.delta) / Math.LN10);
if (maxDec != null && dec > maxDec) if (maxDec != null && dec > maxDec)
dec = maxDec; dec = maxDec;
var magn = Math.pow(10, -dec); var magn = Math.pow(10, -dec),
var norm = axis.delta / magn; // norm is between 1.0 and 10.0 norm = axis.delta / magn, // norm is between 1.0 and 10.0
var size; size,
ticks = [],
start,
i = 0,
v = Number.NaN,
prev;
if (norm < 1.5) if (norm < 1.5)
size = 1; size = 1;
...@@ -1275,9 +1283,8 @@ ...@@ -1275,9 +1283,8 @@
axis.tickDecimals = Math.max(0, maxDec != null ? maxDec : dec); axis.tickDecimals = Math.max(0, maxDec != null ? maxDec : dec);
axis.tickSize = opts.tickSize || size; axis.tickSize = opts.tickSize || size;
axis.tickGenerator = function (axis) { start = floorInBase(axis.min, axis.tickSize)
var ticks = [], start = floorInBase(axis.min, axis.tickSize),
i = 0, v = Number.NaN, prev;
do { do {
prev = v; prev = v;
v = start + i * axis.tickSize; v = start + i * axis.tickSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment