|
|
|
|
@ -771,36 +771,28 @@
|
|
|
|
|
var s, m, t = axis.options.transform || identity,
|
|
|
|
|
it = axis.options.inverseTransform;
|
|
|
|
|
|
|
|
|
|
// precompute how much the axis is scaling a point
|
|
|
|
|
// in canvas space
|
|
|
|
|
if (axis.direction == "x") {
|
|
|
|
|
// precompute how much the axis is scaling a point
|
|
|
|
|
// in canvas space
|
|
|
|
|
s = axis.scale = plotWidth / (t(axis.max) - t(axis.min));
|
|
|
|
|
m = t(axis.min);
|
|
|
|
|
|
|
|
|
|
// data point to canvas coordinate
|
|
|
|
|
if (t == identity) // slight optimization
|
|
|
|
|
axis.p2c = function (p) { return (p - m) * s; };
|
|
|
|
|
else
|
|
|
|
|
axis.p2c = function (p) { return (t(p) - m) * s; };
|
|
|
|
|
// canvas coordinate to data point
|
|
|
|
|
if (!it)
|
|
|
|
|
axis.c2p = function (c) { return m + c / s; };
|
|
|
|
|
else
|
|
|
|
|
axis.c2p = function (c) { return it(m + c / s); };
|
|
|
|
|
s = axis.scale = plotWidth / Math.abs(t(axis.max) - t(axis.min));
|
|
|
|
|
m = Math.min(t(axis.max), t(axis.min));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
s = axis.scale = plotHeight / (t(axis.max) - t(axis.min));
|
|
|
|
|
m = t(axis.max);
|
|
|
|
|
|
|
|
|
|
if (t == identity)
|
|
|
|
|
axis.p2c = function (p) { return (m - p) * s; };
|
|
|
|
|
else
|
|
|
|
|
axis.p2c = function (p) { return (m - t(p)) * s; };
|
|
|
|
|
if (!it)
|
|
|
|
|
axis.c2p = function (c) { return m - c / s; };
|
|
|
|
|
else
|
|
|
|
|
axis.c2p = function (c) { return it(m - c / s); };
|
|
|
|
|
s = axis.scale = plotHeight / Math.abs(t(axis.max) - t(axis.min));
|
|
|
|
|
s = -s;
|
|
|
|
|
m = Math.max(t(axis.max), t(axis.min));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// data point to canvas coordinate
|
|
|
|
|
if (t == identity) // slight optimization
|
|
|
|
|
axis.p2c = function (p) { return (p - m) * s; };
|
|
|
|
|
else
|
|
|
|
|
axis.p2c = function (p) { return (t(p) - m) * s; };
|
|
|
|
|
// canvas coordinate to data point
|
|
|
|
|
if (!it)
|
|
|
|
|
axis.c2p = function (c) { return m + c / s; };
|
|
|
|
|
else
|
|
|
|
|
axis.c2p = function (c) { return it(m + c / s); };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function measureTickLabels(axis) {
|
|
|
|
|
|