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
| Constructor | Modifiers | Description |
|---|---|---|
| constructor(data) | Constructs a new instance of the FieldCache class |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| fields | FieldWithIndex[] |
Methods
| Method | Modifiers | Description |
|---|---|---|
| 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
| Parameter | Type | Description |
|---|---|---|
| data | DataFrame |
fields property
Signature
typescript
fields: FieldWithIndex[];getFieldByName method
Returns the first field with the given name.
Signature
typescript
getFieldByName(name: string): FieldWithIndex | undefined;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string |
Returns:
FieldWithIndex | undefined
getFields method
Signature
typescript
getFields(type?: FieldType): FieldWithIndex[];Parameters
| Parameter | Type | Description |
|---|---|---|
| type | FieldType |
Returns:
FieldWithIndex[]
getFieldsByLabel method
Returns the fields with the given label.
Signature
typescript
getFieldsByLabel(label: string, value: string): FieldWithIndex[];Parameters
| Parameter | Type | Description |
|---|---|---|
| label | string | |
| value | string |
Returns:
FieldWithIndex[]
getFirstFieldOfType method
Signature
typescript
getFirstFieldOfType(type: FieldType, includeHidden?: boolean): FieldWithIndex | undefined;Parameters
| Parameter | Type | Description |
|---|---|---|
| type | FieldType | |
| includeHidden | boolean |
Returns:
FieldWithIndex | undefined
hasFieldNamed method
Signature
typescript
hasFieldNamed(name: string): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string |
Returns:
boolean
hasFieldOfType method
Signature
typescript
hasFieldOfType(type: FieldType): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| type | FieldType |
Returns:
boolean
hasFieldWithNameAndType method
Signature
typescript
hasFieldWithNameAndType(name: string, type: FieldType): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | |
| type | FieldType |
Returns:
boolean
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Scroll for more