Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Enterprise Open source

FieldCache class

Signature

typescript
export declare class FieldCache 

Import

typescript
import { FieldCache } from '@grafana/data';

Constructors

ConstructorModifiersDescription
constructor(data)Constructs a new instance of the FieldCache class

Properties

PropertyModifiersTypeDescription
fieldsFieldWithIndex[]

Methods

MethodModifiersDescription
getFieldByName(name)Returns the first field with the given name.
getFields(type)
getFieldsByLabel(label, value)Returns the fields with the given label.
getFirstFieldOfType(type, includeHidden)
hasFieldNamed(name)
hasFieldOfType(type)
hasFieldWithNameAndType(name, type)

constructor(data)

Constructs a new instance of the FieldCache class

Signature

typescript
constructor(data: DataFrame);

Parameters

ParameterTypeDescription
dataDataFrame

fields property

Signature

typescript
fields: FieldWithIndex[];

getFieldByName method

Returns the first field with the given name.

Signature

typescript
getFieldByName(name: string): FieldWithIndex | undefined;

Parameters

ParameterTypeDescription
namestring

Returns:

FieldWithIndex | undefined

getFields method

Signature

typescript
getFields(type?: FieldType): FieldWithIndex[];

Parameters

ParameterTypeDescription
typeFieldType

Returns:

FieldWithIndex[]

getFieldsByLabel method

Returns the fields with the given label.

Signature

typescript
getFieldsByLabel(label: string, value: string): FieldWithIndex[];

Parameters

ParameterTypeDescription
labelstring
valuestring

Returns:

FieldWithIndex[]

getFirstFieldOfType method

Signature

typescript
getFirstFieldOfType(type: FieldType, includeHidden?: boolean): FieldWithIndex | undefined;

Parameters

ParameterTypeDescription
typeFieldType
includeHiddenboolean

Returns:

FieldWithIndex | undefined

hasFieldNamed method

Signature

typescript
hasFieldNamed(name: string): boolean;

Parameters

ParameterTypeDescription
namestring

Returns:

boolean

hasFieldOfType method

Signature

typescript
hasFieldOfType(type: FieldType): boolean;

Parameters

ParameterTypeDescription
typeFieldType

Returns:

boolean

hasFieldWithNameAndType method

Signature

typescript
hasFieldWithNameAndType(name: string, type: FieldType): boolean;

Parameters

ParameterTypeDescription
namestring
typeFieldType

Returns:

boolean