Revert "Calcs: Update diff percent to be a percent" (#91563)

Revert "Calcs: Update diff percent to be a percent (#90533)"

This reverts commit 5e21898294.
pull/91564/head
Ihor Yeromin 11 months ago committed by GitHub
parent d4916207a0
commit da291998cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      packages/grafana-data/src/transformations/fieldReducer.test.ts
  2. 2
      packages/grafana-data/src/transformations/fieldReducer.ts

@ -55,14 +55,13 @@ describe('Stats Calculators', () => {
it('should calculate basic stats', () => { it('should calculate basic stats', () => {
const stats = reduceField({ const stats = reduceField({
field: basicTable.fields[0], field: basicTable.fields[0],
reducers: [ReducerID.first, ReducerID.last, ReducerID.mean, ReducerID.count, ReducerID.diffperc], reducers: [ReducerID.first, ReducerID.last, ReducerID.mean, ReducerID.count],
}); });
expect(stats.first).toEqual(10); expect(stats.first).toEqual(10);
expect(stats.last).toEqual(20); expect(stats.last).toEqual(20);
expect(stats.mean).toEqual(15); expect(stats.mean).toEqual(15);
expect(stats.count).toEqual(2); expect(stats.count).toEqual(2);
expect(stats.diffperc).toEqual(100);
}); });
it('should handle undefined field data without crashing', () => { it('should handle undefined field data without crashing', () => {

@ -582,7 +582,7 @@ export function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero:
} }
if (isNumber(calcs.firstNotNull) && isNumber(calcs.diff)) { if (isNumber(calcs.firstNotNull) && isNumber(calcs.diff)) {
calcs.diffperc = (calcs.diff / calcs.firstNotNull) * 100; calcs.diffperc = calcs.diff / calcs.firstNotNull;
} }
return calcs; return calcs;
} }

Loading…
Cancel
Save