DataFrameView class

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

This abstraction will present the contents of a DataFrame as if it were a well typed javascript object Vector.

Signature

  1. export declare class DataFrameView<T = any> extends FunctionalVector<T>

Import

  1. import { DataFrameView } from '@grafana/data';

Remarks

The DataFrameView.get() is optimized for use in a loop and will return same object. See function for more details.

Constructors

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

Properties

PropertyModifiersTypeDescription
dataFrameDataFrame(BETA)
fields{
readonly [Property in keyof T]: Field<T[Property]>;
}
(BETA)
lengthnumber(BETA)

Methods

MethodModifiersDescription
get(idx)(BETA) The contents of the object returned from this function are optimized for use in a loop. All calls return the same object but the index has changed.
getFieldDisplayProcessor(colIndex)(BETA) Helper function to return the DisplayProcessor for a given field column.
toArray()(BETA)

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

constructor(data)

Constructs a new instance of the DataFrameView class

Signature

  1. constructor(data: DataFrame);

Parameters

ParameterTypeDescription
dataDataFrame

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

dataFrame property

Signature

  1. get dataFrame(): DataFrame;

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

fields property

Signature

  1. readonly fields: {
  2. readonly [Property in keyof T]: Field<T[Property]>;
  3. };

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

length property

Signature

  1. get length(): number;

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

get method

The contents of the object returned from this function are optimized for use in a loop. All calls return the same object but the index has changed.

Signature

  1. get(idx: number): T;

Parameters

ParameterTypeDescription
idxnumberThe index of the object you currently are inspecting

Returns:

T

Example

  1. // `first`, `second` and `third` will all point to the same contents at index 2:
  2. const first = view.get(0);
  3. const second = view.get(1);
  4. const third = view.get(2);
  5. // If you need three different objects, consider something like:
  6. const first = { ...view.get(0) };
  7. const second = { ...view.get(1) };
  8. const third = { ...view.get(2) };

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

getFieldDisplayProcessor method

Helper function to return the DisplayProcessor for a given field column.

Signature

  1. getFieldDisplayProcessor(colIndex: number): DisplayProcessor | undefined;

Parameters

ParameterTypeDescription
colIndexnumberthe field column index for the data frame.

Returns:

DisplayProcessor | undefined

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

toArray method

Signature

  1. toArray(): T[];

Returns:

T[]