Comprehensive field configuration, display processing, color management, thresholds, and override system for customizing field appearance and behavior in data visualizations.
Core field configuration and validation functions.
/**
* Applies field override rules to DataFrames
* @param options - Override options with field configs and data
* @returns Array of DataFrames with applied overrides
*/
function applyFieldOverrides(options: ApplyFieldOverrideOptions): DataFrame[];
/**
* Applies raw field overrides without processing
* @param data - Panel data to apply overrides to
* @param fieldConfig - Field configuration with overrides
* @returns Processed panel data
*/
function applyRawFieldOverrides(data: PanelData, fieldConfig: FieldConfigSource): PanelData;
/**
* Validates field configuration
* @param config - Field configuration to validate
* @returns Validation result with errors if any
*/
function validateFieldConfig(config: FieldConfig): ValidationResult;
/**
* React hook for field overrides
* @param data - Panel data
* @returns Processed data with overrides applied
*/
function useFieldOverrides(data: PanelData): PanelData;Functions for processing fields for display including formatting and value processing.
/**
* Processes fields for display with formatting and calculations
* @param options - Display processing options
* @returns Array of processed field displays
*/
function getFieldDisplayValues(options: GetFieldDisplayValuesOptions): FieldDisplay[];
/**
* Creates display processor for field values
* @param options - Display processor options
* @returns Function to process individual values
*/
function getDisplayProcessor(options: DisplayProcessorOptions): DisplayProcessor;
/**
* Creates raw display processor without formatting
* @param options - Raw processor options
* @returns Function for raw value processing
*/
function getRawDisplayProcessor(options: DisplayProcessorOptions): DisplayProcessor;
/**
* Creates proxy for field display values
* @param field - Field to create proxy for
* @returns Proxy object for accessing display values
*/
function getFieldDisplayValuesProxy(field: Field): FieldDisplayValueProxy;Functions for field naming, display names, and unique name generation.
/**
* Gets display name for a field considering frame context
* @param field - Field to get display name for
* @param frame - Parent DataFrame
* @param allFrames - All related DataFrames for context
* @returns Computed display name
*/
function getFieldDisplayName(field: Field, frame?: DataFrame, allFrames?: DataFrame[]): string;
/**
* Gets display name for a DataFrame
* @param frame - DataFrame to get display name for
* @returns Computed display name
*/
function getFrameDisplayName(frame: DataFrame): string;
/**
* Caches field display names for performance
* @param frame - DataFrame to cache names for
*/
function cacheFieldDisplayNames(frame: DataFrame): void;
/**
* Generates unique field name within a DataFrame
* @param name - Desired field name
* @param frame - DataFrame to check for conflicts
* @returns Unique field name
*/
function getUniqueFieldName(name: string, frame: DataFrame): string;Color management system for fields including color modes and series colors.
/**
* Gets color mode for a specific field
* @param field - Field to get color mode for
* @returns Field color mode configuration
*/
function getFieldColorModeForField(field: Field): FieldColorMode;
/**
* Gets color mode by identifier
* @param mode - Color mode ID
* @returns Color mode configuration
*/
function getFieldColorMode(mode: string): FieldColorMode;
/**
* Gets series color for field based on options
* @param options - Series color options
* @returns Color value for the series
*/
function getFieldSeriesColor(options: SeriesColorOptions): string;
/**
* Registry of available field color modes
*/
const fieldColorModeRegistry: Registry<FieldColorMode>;Threshold management for field value ranges and visual indicators.
/**
* Sorts thresholds by value
* @param thresholds - Array of threshold definitions
* @returns Sorted thresholds array
*/
function sortThresholds(thresholds: Threshold[]): Threshold[];
/**
* Gets active threshold for a specific value
* @param value - Value to check against thresholds
* @param thresholds - Array of threshold definitions
* @returns Active threshold or undefined
*/
function getActiveThreshold(value: number, thresholds: Threshold[]): Threshold | undefined;Functions for field scaling and range calculations.
/**
* Creates scale calculator function for field
* @param field - Field to create scale for
* @param theme - Theme for color calculations
* @returns Scale calculator function
*/
function getScaleCalculator(field: Field, theme: GrafanaTheme2): ScaleCalculator;
/**
* Gets field configuration with computed min/max values
* @param field - Field to process
* @returns Field config with min/max values
*/
function getFieldConfigWithMinMax(field: Field): FieldConfig;
/**
* Calculates numeric range and delta for field
* @param field - Field to analyze
* @returns Object with min, max, and delta values
*/
function getMinMaxAndDelta(field: Field): { min: number; max: number; delta: number };Functions for processing different types of field overrides.
/**
* Identity override processor (no transformation)
*/
function identityOverrideProcessor(value: any, context: FieldOverrideContext): any;
/**
* Number field override processor
*/
function numberOverrideProcessor(value: any, context: FieldOverrideContext): number;
/**
* Display name override processor
*/
function displayNameOverrideProcessor(value: any, context: FieldOverrideContext): string;
/**
* Data links override processor
*/
function dataLinksOverrideProcessor(value: any, context: FieldOverrideContext): DataLink[];
/**
* Value mappings override processor
*/
function valueMappingsOverrideProcessor(value: any, context: FieldOverrideContext): ValueMapping[];
/**
* Select field override processor
*/
function selectOverrideProcessor(value: any, context: FieldOverrideContext): SelectableValue;
/**
* String field override processor
*/
function stringOverrideProcessor(value: any, context: FieldOverrideContext): string;
/**
* Thresholds override processor
*/
function thresholdsOverrideProcessor(value: any, context: FieldOverrideContext): ThresholdsConfig;
/**
* Unit override processor
*/
function unitOverrideProcessor(value: any, context: FieldOverrideContext): string;
/**
* Boolean override processor
*/
function booleanOverrideProcessor(value: any, context: FieldOverrideContext): boolean;Registry systems for field configuration options and editors.
/**
* Registry for field configuration options
*/
class FieldConfigOptionsRegistry extends Registry<FieldConfigPropertyItem> {
register(item: FieldConfigPropertyItem): void;
}
/**
* Registry of standard field config editors
*/
const standardFieldConfigEditorRegistry: FieldConfigOptionsRegistry;
/**
* Registry of standard editors
*/
const standardEditorsRegistry: Registry<StandardEditorsRegistryItem>;Advanced display value processing with alignment and templating.
/**
* Checks if field has links
* @param field - Field to check
* @returns True if field has data links
*/
function hasLinks(field: Field): boolean;
/**
* Calculates alignment factors for display values
* @param values - Array of display values
* @returns Alignment factors for consistent display
*/
function getDisplayValueAlignmentFactors(values: DisplayValue[]): DisplayValueAlignmentFactors;
/**
* Fixes cell template expressions
* @param expr - Template expression to fix
* @returns Fixed template expression
*/
function fixCellTemplateExpressions(expr: string): string;
/**
* Gets links supplier for field
* @param field - Field to get links for
* @returns Function that supplies links
*/
function getLinksSupplier(field: Field): LinkModelSupplier;/**
* Core field interface representing a data column
*/
interface Field<T = any, V = Vector<T>> {
/** Field name */
name: string;
/** Field data type */
type: FieldType;
/** Field configuration */
config: FieldConfig<T>;
/** Field values */
values: V;
/** Optional labels */
labels?: Labels;
/** Field state information */
state?: FieldState;
}
/**
* Field configuration interface
*/
interface FieldConfig<T = any> {
/** Display name override */
displayName?: string;
/** Display name from data source */
displayNameFromDS?: string;
/** Field description */
description?: string;
/** Field path */
path?: string;
/** Whether field can be written to */
writeable?: boolean;
/** Whether field is filterable */
filterable?: boolean;
/** Field unit */
unit?: string;
/** Decimal places */
decimals?: number;
/** Minimum value */
min?: number;
/** Maximum value */
max?: number;
/** Value mappings */
mappings?: ValueMapping[];
/** Thresholds configuration */
thresholds?: ThresholdsConfig;
/** Color configuration */
color?: FieldColor;
/** Data links */
links?: DataLink[];
/** Whether field should not be cached */
noValue?: T;
/** Custom properties */
custom?: T;
}
/**
* Field state information
*/
interface FieldState {
/** Display name */
displayName?: string;
/** Whether field is hidden */
hidden?: boolean;
/** Cached calculated values */
calcs?: FieldCalcs;
/** Field range information */
range?: NumericRange;
/** Series index */
seriesIndex?: number;
}
/**
* Field display information
*/
interface FieldDisplay {
/** Display name */
name: string;
/** Field reference */
field: Field;
/** Display value */
display: DisplayValue;
/** Optional sparkline data */
sparkline?: FieldSparkline;
/** Whether field has links */
hasLinks: boolean;
/** Link supplier function */
getLinks?: LinkModelSupplier;
}
/**
* Options for getting field display values
*/
interface GetFieldDisplayValuesOptions {
/** Data to process */
data?: PanelData;
/** Field configuration */
fieldConfig: FieldConfigSource;
/** Reduce options */
reduceOptions: ReduceDataOptions;
/** Sparkline options */
sparkline?: boolean;
/** Theme */
theme: GrafanaTheme2;
/** Replace variables function */
replaceVariables?: InterpolateFunction;
/** Time zone */
timeZone?: TimeZone;
}
/**
* Field color configuration
*/
interface FieldColor {
/** Color mode */
mode: FieldColorModeId;
/** Fixed color value */
fixedColor?: string;
/** Series by value */
seriesBy?: FieldColorSeriesByMode;
}
/**
* Field color mode definition
*/
interface FieldColorMode {
/** Color mode ID */
id: FieldColorModeId;
/** Display name */
name: string;
/** Description */
description: string;
/** Color calculation function */
getCalculator: (field: Field, theme: GrafanaTheme2) => ColorCalculator;
/** Whether mode uses thresholds */
useSeriesColors?: boolean;
}
/**
* Threshold definition
*/
interface Threshold {
/** Threshold value */
value: number;
/** Threshold color */
color: string;
/** Threshold state */
state?: ThresholdState;
}
/**
* Thresholds configuration
*/
interface ThresholdsConfig {
/** Threshold mode */
mode: ThresholdsMode;
/** Array of thresholds */
steps: Threshold[];
}
/**
* Field sparkline data
*/
interface FieldSparkline {
/** Y-axis values */
y: Field;
/** X-axis values (optional) */
x?: Field;
/** Time range */
timeRange?: TimeRange;
/** Highlight index */
highlightIndex?: number;
}
/**
* Reduce data options
*/
interface ReduceDataOptions {
/** Values to show */
values?: boolean;
/** Calculation types */
calcs: string[];
/** Fields to reduce */
fields?: string;
/** Limit number of results */
limit?: number;
}
/**
* Field calculations cache
*/
interface FieldCalcs {
[key: string]: number;
}
/**
* Numeric range
*/
interface NumericRange {
/** Minimum value */
min?: number;
/** Maximum value */
max?: number;
/** Delta (max - min) */
delta: number;
}
/**
* Field override context
*/
interface FieldOverrideContext {
/** Field being processed */
field: Field;
/** Parent DataFrame */
data: DataFrame[];
/** Data index */
dataFrameIndex: number;
/** Field index */
fieldIndex: number;
/** Scoped variables */
scopedVars?: ScopedVars;
/** Replace variables function */
replaceVariables?: InterpolateFunction;
}
/**
* Display value alignment factors
*/
interface DisplayValueAlignmentFactors {
/** Title alignment */
title: string;
/** Text alignment */
text: string;
}
/**
* Field configuration source
*/
interface FieldConfigSource<TOptions = any> {
/** Default field configuration */
defaults: FieldConfig<TOptions>;
/** Override rules */
overrides: ConfigOverrideRule[];
}
/**
* Apply field override options
*/
interface ApplyFieldOverrideOptions {
/** Panel data */
data?: PanelData;
/** Field configuration */
fieldConfig: FieldConfigSource;
/** Theme */
theme: GrafanaTheme2;
/** Replace variables function */
replaceVariables?: InterpolateFunction;
/** Time zone */
timeZone?: TimeZone;
/** Field matchers */
fieldMatchers: FieldMatcherInfo[];
/** Value matchers */
valueMatchers: ValueMatcherInfo[];
}
/**
* Field configuration settings types
*/
interface NumberFieldConfigSettings {
placeholder?: string;
integer?: boolean;
min?: number;
max?: number;
step?: number;
}
interface SliderFieldConfigSettings {
min: number;
max: number;
step?: number;
included?: boolean;
marks?: SliderMarks;
}
interface StringFieldConfigSettings {
placeholder?: string;
maxLength?: number;
expandTemplateVars?: boolean;
useTextarea?: boolean;
}
interface SelectFieldConfigSettings<T> {
options: Array<SelectableValue<T>>;
allowCustomValue?: boolean;
isClearable?: boolean;
placeholder?: string;
}
/**
* Variable constants
*/
const VAR_SERIES_NAME = '__series.name';
const VAR_FIELD_NAME = '__field.name';
const VAR_FIELD_LABELS = '__field.labels';
const VAR_CALC = '__calc';
const VAR_CELL_PREFIX = '__cell_';
const DEFAULT_FIELD_DISPLAY_VALUES_LIMIT = 25;
/**
* Field name picker modes
*/
enum FieldNamePickerBaseNameMode {
IncludeAll = 'include',
ExcludeBaseNames = 'exclude'
}