mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08:00
Refactoring code. Change Y-Zero to Y-Level.
This commit is contained in:
37
public/vendor/flot/jquery.flot.js
vendored
37
public/vendor/flot/jquery.flot.js
vendored
@ -1622,14 +1622,24 @@ Licensed under the MIT license.
|
||||
return axis.show || axis.reserveSpace;
|
||||
});
|
||||
|
||||
$.each(allocatedAxes, function (_, axis) {
|
||||
// make the ticks
|
||||
setupTickGeneration(axis);
|
||||
setTicks(axis);
|
||||
snapRangeToTicks(axis, axis.ticks);
|
||||
// find labelWidth/Height for axis
|
||||
measureTickLabels(axis);
|
||||
});
|
||||
var snaped = false;
|
||||
for (var i = 0; i < 2; i++) {
|
||||
$.each(allocatedAxes, function (_, axis) {
|
||||
// make the ticks
|
||||
setupTickGeneration(axis);
|
||||
setTicks(axis);
|
||||
snaped = snapRangeToTicks(axis, axis.ticks) || snaped;
|
||||
// find labelWidth/Height for axis
|
||||
measureTickLabels(axis);
|
||||
});
|
||||
|
||||
if (snaped) {
|
||||
executeHooks(hooks.processRange, []);
|
||||
snaped = false;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// with all dimensions calculated, we can compute the
|
||||
// axis bounding boxes, start from the outside
|
||||
@ -1646,6 +1656,7 @@ Licensed under the MIT license.
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
plotWidth = surface.width - plotOffset.left - plotOffset.right;
|
||||
plotHeight = surface.height - plotOffset.bottom - plotOffset.top;
|
||||
|
||||
@ -1879,13 +1890,19 @@ Licensed under the MIT license.
|
||||
}
|
||||
|
||||
function snapRangeToTicks(axis, ticks) {
|
||||
var changed = false;
|
||||
if (axis.options.autoscaleMargin && ticks.length > 0) {
|
||||
// snap to ticks
|
||||
if (axis.options.min == null)
|
||||
if (axis.options.min == null) {
|
||||
axis.min = Math.min(axis.min, ticks[0].v);
|
||||
if (axis.options.max == null && ticks.length > 1)
|
||||
changed = true;
|
||||
}
|
||||
if (axis.options.max == null && ticks.length > 1) {
|
||||
axis.max = Math.max(axis.max, ticks[ticks.length - 1].v);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
function draw() {
|
||||
|
Reference in New Issue
Block a user