Graph: Fixes auto decimals issue in legend and tooltip (#30628)

* Graph: Fixes auto decimals issue in legend and tooltip

* Updated decimals
This commit is contained in:
Torkel Ödegaard
2021-01-26 12:37:48 +01:00
committed by GitHub
parent 2c2869a0ae
commit f109f06485
2 changed files with 7 additions and 46 deletions

View File

@@ -430,25 +430,11 @@ describe('TimeSeries', () => {
};
});
it('should set decimals based on Y axis (expect calculated decimals = 1)', () => {
it('should set decimals to null if no decimals set', () => {
const data = [series];
// Expect ticks with this data will have decimals = 1
updateLegendValues(data, panel, height);
expect(data[0].decimals).toBe(2);
});
it('should set decimals based on Y axis to 0 if calculated decimals = 0)', () => {
testData.datapoints = [
[10, 2],
[0, 3],
[100, 4],
[80, 5],
];
series = new TimeSeries(testData);
series.getFlotPairs();
const data = [series];
updateLegendValues(data, panel, height);
expect(data[0].decimals).toBe(0);
expect(data[0].decimals).toBe(null);
});
it('should set decimals to Y axis decimals + 1', () => {