SeriesData: remove color from Field (#17044)

This commit is contained in:
Ryan McKinley 2019-05-13 22:26:55 -07:00 committed by Torkel Ödegaard
parent 01a7c1f098
commit bbb1427f46
3 changed files with 3 additions and 4 deletions

View File

@ -47,7 +47,6 @@ export interface Field {
unit?: string;
dateFormat?: string; // Source data format
decimals?: number | null; // Significant digits (for display)
color?: string;
min?: number | null;
max?: number | null;
}

View File

@ -18,7 +18,7 @@ describe('Process simple display values', () => {
getDisplayProcessor(),
// 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)
getDisplayProcessor({ field: { unit: 'locale' } }),

View File

@ -42,7 +42,7 @@ export function getDisplayProcessor(options?: DisplayValueOptions): DisplayProce
return (value: any) => {
const { mappings, thresholds, theme } = options;
let color = field.color;
let color;
let text = _.toString(value);
let numeric = toNumber(value);
@ -76,7 +76,7 @@ export function getDisplayProcessor(options?: DisplayValueOptions): DisplayProce
const { decimals, scaledDecimals } = getDecimalsForValue(value, field.decimals);
text = formatFunc(numeric, decimals, scaledDecimals, options.isUtc);
}
if (thresholds && thresholds.length > 0) {
if (thresholds && thresholds.length) {
color = getColorFromThreshold(numeric, thresholds, theme);
}
}