diff --git a/packages/grafana-data/src/field/displayProcessor.test.ts b/packages/grafana-data/src/field/displayProcessor.test.ts index 990520bb68e..261e15bf8d6 100644 --- a/packages/grafana-data/src/field/displayProcessor.test.ts +++ b/packages/grafana-data/src/field/displayProcessor.test.ts @@ -164,6 +164,16 @@ describe('Format value', () => { expect(instance(value).numeric).toEqual(1); }); + it('should not map 1kW to the value for 1W', () => { + const valueMappings: ValueMapping[] = [{ id: 0, text: 'mapped', type: MappingType.ValueToText, value: '1' }]; + const value = '1000'; + const instance = getDisplayProcessorFromConfig({ decimals: 1, mappings: valueMappings, unit: 'watt' }); + + const result = instance(value); + + expect(result.text).toEqual('1.0'); + }); + it('With null value and thresholds should use base color', () => { const instance = getDisplayProcessorFromConfig({ thresholds: { diff --git a/packages/grafana-data/src/field/displayProcessor.ts b/packages/grafana-data/src/field/displayProcessor.ts index 71bde8b25df..2c4786ef97c 100644 --- a/packages/grafana-data/src/field/displayProcessor.ts +++ b/packages/grafana-data/src/field/displayProcessor.ts @@ -90,14 +90,6 @@ export function getDisplayProcessor(options?: DisplayProcessorOptions): DisplayP text = v.text; suffix = v.suffix; prefix = v.prefix; - - // Check if the formatted text mapped to a different value - if (mappings && mappings.length > 0) { - const mappedValue = getMappedValue(mappings, text); - if (mappedValue) { - text = mappedValue.text; - } - } } // Return the value along with scale info