mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
SeriesData: remove color from Field (#17044)
This commit is contained in:
committed by
Torkel Ödegaard
parent
01a7c1f098
commit
bbb1427f46
@@ -47,7 +47,6 @@ export interface Field {
|
|||||||
unit?: string;
|
unit?: string;
|
||||||
dateFormat?: string; // Source data format
|
dateFormat?: string; // Source data format
|
||||||
decimals?: number | null; // Significant digits (for display)
|
decimals?: number | null; // Significant digits (for display)
|
||||||
color?: string;
|
|
||||||
min?: number | null;
|
min?: number | null;
|
||||||
max?: number | null;
|
max?: number | null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe('Process simple display values', () => {
|
|||||||
getDisplayProcessor(),
|
getDisplayProcessor(),
|
||||||
|
|
||||||
// Add a simple option that is not used (uses a different base class)
|
// Add a simple option that is not used (uses a different base class)
|
||||||
getDisplayProcessor({ field: { color: '#FFF' } }),
|
getDisplayProcessor({ field: { min: 0, max: 100 } }),
|
||||||
|
|
||||||
// Add a simple option that is not used (uses a different base class)
|
// Add a simple option that is not used (uses a different base class)
|
||||||
getDisplayProcessor({ field: { unit: 'locale' } }),
|
getDisplayProcessor({ field: { unit: 'locale' } }),
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export function getDisplayProcessor(options?: DisplayValueOptions): DisplayProce
|
|||||||
|
|
||||||
return (value: any) => {
|
return (value: any) => {
|
||||||
const { mappings, thresholds, theme } = options;
|
const { mappings, thresholds, theme } = options;
|
||||||
let color = field.color;
|
let color;
|
||||||
|
|
||||||
let text = _.toString(value);
|
let text = _.toString(value);
|
||||||
let numeric = toNumber(value);
|
let numeric = toNumber(value);
|
||||||
@@ -76,7 +76,7 @@ export function getDisplayProcessor(options?: DisplayValueOptions): DisplayProce
|
|||||||
const { decimals, scaledDecimals } = getDecimalsForValue(value, field.decimals);
|
const { decimals, scaledDecimals } = getDecimalsForValue(value, field.decimals);
|
||||||
text = formatFunc(numeric, decimals, scaledDecimals, options.isUtc);
|
text = formatFunc(numeric, decimals, scaledDecimals, options.isUtc);
|
||||||
}
|
}
|
||||||
if (thresholds && thresholds.length > 0) {
|
if (thresholds && thresholds.length) {
|
||||||
color = getColorFromThreshold(numeric, thresholds, theme);
|
color = getColorFromThreshold(numeric, thresholds, theme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user