mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
graph: change tick decimal calculation for y-axis
Fixes #8872. Use the automatic calculation by Flot to get the number of decimal places for ticks on the y-axis rather than the number of decimal places for the min value.
This commit is contained in:
parent
1ce134cc6f
commit
ef0c90b9ca
@ -588,7 +588,6 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
|
||||
if (axis.ticks[axis.ticks.length - 1] > axis.max) {
|
||||
axis.max = axis.ticks[axis.ticks.length - 1];
|
||||
}
|
||||
axis.tickDecimals = decimalPlaces(min);
|
||||
} else {
|
||||
axis.ticks = [1, 2];
|
||||
delete axis.min;
|
||||
|
@ -139,8 +139,6 @@ describe('grafanaGraph', function() {
|
||||
expect(axisAutoscale.ticks.length).to.be(8);
|
||||
expect(axisAutoscale.ticks[0]).to.be(0.001);
|
||||
expect(axisAutoscale.ticks[7]).to.be(10000);
|
||||
expect(axisAutoscale.tickDecimals).to.be(3);
|
||||
|
||||
|
||||
var axisFixedscale = ctx.plotOptions.yaxes[1];
|
||||
expect(axisFixedscale.min).to.be(0.05);
|
||||
@ -148,8 +146,6 @@ describe('grafanaGraph', function() {
|
||||
expect(axisFixedscale.ticks.length).to.be(5);
|
||||
expect(axisFixedscale.ticks[0]).to.be(0.1);
|
||||
expect(axisFixedscale.ticks[4]).to.be(1000);
|
||||
expect(axisFixedscale.tickDecimals).to.be(1);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -172,7 +168,6 @@ describe('grafanaGraph', function() {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
@ -189,7 +184,7 @@ describe('grafanaGraph', function() {
|
||||
data[0].yaxis = 1;
|
||||
});
|
||||
|
||||
it('should set min to 0.1 and add a tick for 0.1 and tickDecimals to be 0', function() {
|
||||
it('should set min to 0.1 and add a tick for 0.1', function() {
|
||||
var axisAutoscale = ctx.plotOptions.yaxes[0];
|
||||
expect(axisAutoscale.transform(100)).to.be(2);
|
||||
expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
|
||||
@ -198,7 +193,6 @@ describe('grafanaGraph', function() {
|
||||
expect(axisAutoscale.ticks.length).to.be(6);
|
||||
expect(axisAutoscale.ticks[0]).to.be(0.1);
|
||||
expect(axisAutoscale.ticks[5]).to.be(10000);
|
||||
expect(axisAutoscale.tickDecimals).to.be(0);
|
||||
});
|
||||
});
|
||||
|
||||
@ -222,7 +216,6 @@ describe('grafanaGraph', function() {
|
||||
expect(axisAutoscale.ticks[0]).to.be(0.1);
|
||||
expect(axisAutoscale.ticks[7]).to.be(262144);
|
||||
expect(axisAutoscale.max).to.be(262144);
|
||||
expect(axisAutoscale.tickDecimals).to.be(0);
|
||||
});
|
||||
|
||||
it('should set axis max to be max tick value', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user