Commit 3dd4b4aa authored by olau@iola.dk's avatar olau@iola.dk

Fixes for tickless axes plus change autoscaleMargin to avoid snapping

to ticks if it's 0, based on patches by Ara Anjargolian


git-svn-id: https://flot.googlecode.com/svn/trunk@290 1e0a6537-2640-0410-bfb7-f154510ff394
parent a493cc49
......@@ -166,7 +166,7 @@
};
plot.getData = function () { return series; };
plot.getAxis = function (dir, number) {
var a = (dir == x ? xaxes : yaxes)[number - 1];
var a = (dir == "x" ? xaxes : yaxes)[number - 1];
if (a && !a.used)
a = null;
return a;
......@@ -867,7 +867,7 @@
}
function computeAxisBox(axis) {
if (!axis || (!axis.used && !(axis.labelWidth || axis.labelHeight)))
if (!axis || !axis.labelWidth || !axis.labelHeight)
return;
// find the bounding box of the axis by looking at label
......@@ -939,6 +939,9 @@
}
function fixupAxisBox(axis) {
if (!axis || !axis.labelWidth || !axis.labelHeight)
return;
// set remaining bounding box coordinates
if (axis.direction == "x") {
axis.box.left = plotOffset.left;
......@@ -1326,7 +1329,7 @@
function setTicks(axis) {
axis.ticks = [];
var oticks = axis.options.ticks, ticks = null;
var oticks = axis.options.ticks, ticks = [];
if (oticks == null || (typeof oticks == "number" && oticks > 0))
ticks = axis.tickGenerator(axis);
else if (oticks) {
......@@ -1356,7 +1359,7 @@
}
function snapRangeToTicks(axis, ticks) {
if (axis.options.autoscaleMargin != null && ticks.length > 0) {
if (axis.options.autoscaleMargin && ticks.length > 0) {
// snap to ticks
if (axis.options.min == null)
axis.min = Math.min(axis.min, ticks[0].v);
......@@ -1513,6 +1516,9 @@
var axis = axes[j], box = axis.box,
t = axis.tickLength, x, y, xoff, yoff;
if (axis.ticks.length == 0)
continue;
ctx.strokeStyle = axis.options.tickColor || $.color.parse(axis.options.color).scale('a', 0.22).toString();
ctx.lineWidth = 1;
......
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