API Reference@grafana/dataFieldCache

FieldCache class

Signature

export declare class FieldCache 

Import

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

constructor(data: DataFrame);

Parameters

ParameterTypeDescription
dataDataFrame

fields property

Signature

fields: FieldWithIndex[];

getFieldByName method

Returns the first field with the given name.

Signature

getFieldByName(name: string): FieldWithIndex | undefined;

Parameters

ParameterTypeDescription
namestring

Returns:

FieldWithIndex | undefined

getFields method

Signature

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

Parameters

ParameterTypeDescription
typeFieldType

Returns:

FieldWithIndex[]

getFieldsByLabel method

Returns the fields with the given label.

Signature

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

Parameters

ParameterTypeDescription
labelstring
valuestring

Returns:

FieldWithIndex[]

getFirstFieldOfType method

Signature

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

Parameters

ParameterTypeDescription
typeFieldType
includeHiddenboolean

Returns:

FieldWithIndex | undefined

hasFieldNamed method

Signature

hasFieldNamed(name: string): boolean;

Parameters

ParameterTypeDescription
namestring

Returns:

boolean

hasFieldOfType method

Signature

hasFieldOfType(type: FieldType): boolean;

Parameters

ParameterTypeDescription
typeFieldType

Returns:

boolean

hasFieldWithNameAndType method

Signature

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

Parameters

ParameterTypeDescription
namestring
typeFieldType

Returns:

boolean