mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'v4.3.x'
This commit is contained in:
commit
f16e3e38ee
@ -555,12 +555,19 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
axis.ticks = [];
|
if (Number.isFinite(min) && Number.isFinite(max)) {
|
||||||
var nextTick;
|
axis.ticks = [];
|
||||||
for (nextTick = min; nextTick <= max; nextTick *= axis.logBase) {
|
var nextTick;
|
||||||
axis.ticks.push(nextTick);
|
for (nextTick = min; nextTick <= max; nextTick *= axis.logBase) {
|
||||||
|
axis.ticks.push(nextTick);
|
||||||
|
}
|
||||||
|
axis.tickDecimals = decimalPlaces(min);
|
||||||
|
} else {
|
||||||
|
axis.ticks = [1, 2];
|
||||||
|
delete axis.min;
|
||||||
|
delete axis.max;
|
||||||
}
|
}
|
||||||
axis.tickDecimals = decimalPlaces(min);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function decimalPlaces(num) {
|
function decimalPlaces(num) {
|
||||||
|
@ -153,6 +153,29 @@ describe('grafanaGraph', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
graphScenario('when logBase is log 10 and data points contain only zeroes', function(ctx) {
|
||||||
|
ctx.setup(function(ctrl, data) {
|
||||||
|
ctrl.panel.yaxes[0].logBase = 10;
|
||||||
|
data[0] = new TimeSeries({
|
||||||
|
datapoints: [[0,1],[0,2],[0,3],[0,4]],
|
||||||
|
alias: 'seriesAutoscale',
|
||||||
|
});
|
||||||
|
data[0].yaxis = 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not set min and max and should create some fake ticks', function() {
|
||||||
|
var axisAutoscale = ctx.plotOptions.yaxes[0];
|
||||||
|
expect(axisAutoscale.transform(100)).to.be(2);
|
||||||
|
expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
|
||||||
|
expect(axisAutoscale.min).to.be(undefined);
|
||||||
|
expect(axisAutoscale.max).to.be(undefined);
|
||||||
|
expect(axisAutoscale.ticks.length).to.be(2);
|
||||||
|
expect(axisAutoscale.ticks[0]).to.be(1);
|
||||||
|
expect(axisAutoscale.ticks[1]).to.be(2);
|
||||||
|
expect(axisAutoscale.tickDecimals).to.be(undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
graphScenario('dashed lines options', function(ctx) {
|
graphScenario('dashed lines options', function(ctx) {
|
||||||
ctx.setup(function(ctrl) {
|
ctx.setup(function(ctrl) {
|
||||||
ctrl.panel.lines = true;
|
ctrl.panel.lines = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user