+++ # ----------------------------------------------------------------------- # Do not edit this file. It is automatically generated by API Documenter. # ----------------------------------------------------------------------- title = "DataFrameView" keywords = ["grafana","documentation","sdk","@grafana/data"] type = "docs" +++ ## 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 ```typescript export declare class DataFrameView extends FunctionalVector ``` Import ```typescript import { DataFrameView } from '@grafana/data'; ``` ## Remarks The [DataFrameView.get()](./data/dataframeview/get.md) is optimized for use in a loop and will return same object. See function for more details. Constructors | Constructor | Modifiers | Description | | --- | --- | --- | | [constructor(data)](#constructor-data) | | (BETA) Constructs a new instance of the DataFrameView class | Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [dataFrame](#dataframe-property) | | DataFrame | (BETA) | | [length](#length-property) | | number | (BETA) | Methods | Method | Modifiers | Description | | --- | --- | --- | | [get(idx)](#get-method) | | (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)](#getfielddisplayprocessor-method) | | (BETA) Helper function to return the [DisplayProcessor](./data/displayprocessor.md) for a given field column. | | [toArray()](#toarray-method) | | (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 ```typescript constructor(data: DataFrame); ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | data | 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. > ### dataFrame property Signature ```typescript 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. > ### length property Signature ```typescript 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 ```typescript get(idx: number): T; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | idx | number | The index of the object you currently are inspecting | Returns: `T` ## Example ```typescript // `first`, `second` and `third` will all point to the same contents at index 2: const first = view.get(0); const second = view.get(1); const third = view.get(2); // If you need three different objects, consider something like: const first = { ...view.get(0) }; const second = { ...view.get(1) }; 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](./data/displayprocessor.md) for a given field column. Signature ```typescript getFieldDisplayProcessor(colIndex: number): DisplayProcessor | null; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | colIndex | number | the field column index for the data frame. | Returns: `DisplayProcessor | null` > 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 ```typescript toArray(): T[]; ``` Returns: `T[]`