+++ # ----------------------------------------------------------------------- # Do not edit this file. It is automatically generated by API Documenter. # ----------------------------------------------------------------------- title = "MutableDataFrame" keywords = ["grafana","documentation","sdk","@grafana/data"] type = "docs" +++ ## MutableDataFrame class Signature ```typescript export declare class MutableDataFrame extends FunctionalVector implements DataFrame, MutableVector ``` Import ```typescript import { MutableDataFrame } from '@grafana/data'; ``` Constructors | Constructor | Modifiers | Description | | --- | --- | --- | | [constructor(source, creator)](#constructor-sourcecreator) | | Constructs a new instance of the MutableDataFrame class | Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [fields](#fields-property) | | MutableField[] | | | [length](#length-property) | | number | | | [meta](#meta-property) | | QueryResultMeta | | | [name](#name-property) | | string | | | [refId](#refid-property) | | string | | | [values](#values-property) | | KeyValue<MutableVector> | | Methods | Method | Modifiers | Description | | --- | --- | --- | | [add(value, addMissingFields)](#add-method) | | Add all properties of the value as fields on the frame | | [addField(f, startLength)](#addfield-method) | | | | [addFieldFor(value, name)](#addfieldfor-method) | | | | [appendRow(row)](#appendrow-method) | | This will add each value to the corresponding column | | [get(idx)](#get-method) | | Get an object with a property for each field in the DataFrame | | [reverse()](#reverse-method) | | Reverse all values | | [set(index, value, addMissingFields)](#set-method) | | | | [toJSON()](#tojson-method) | | The simplified JSON values used in JSON.stringify() | | [validate()](#validate-method) | | | ### constructor(source, creator) Constructs a new instance of the `MutableDataFrame` class Signature ```typescript constructor(source?: DataFrame | DataFrameDTO, creator?: MutableVectorCreator); ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | source | DataFrame | DataFrameDTO | | | creator | MutableVectorCreator | | ### fields property Signature ```typescript fields: MutableField[]; ``` ### length property Signature ```typescript get length(): number; ``` ### meta property Signature ```typescript meta?: QueryResultMeta; ``` ### name property Signature ```typescript name?: string; ``` ### refId property Signature ```typescript refId?: string; ``` ### values property Signature ```typescript values: KeyValue; ``` ### add method Add all properties of the value as fields on the frame Signature ```typescript add(value: T, addMissingFields?: boolean): void; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | value | T | | | addMissingFields | boolean | | Returns: `void` ### addField method Signature ```typescript addField(f: Field | FieldDTO, startLength?: number): MutableField; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | f | Field | FieldDTO | | | startLength | number | | Returns: `MutableField` ### addFieldFor method Signature ```typescript addFieldFor(value: any, name?: string): MutableField; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | value | any | | | name | string | | Returns: `MutableField` ### appendRow method This will add each value to the corresponding column Signature ```typescript appendRow(row: any[]): void; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | row | any[] | | Returns: `void` ### get method Get an object with a property for each field in the DataFrame Signature ```typescript get(idx: number): T; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | idx | number | | Returns: `T` ### reverse method Reverse all values Signature ```typescript reverse(): void; ``` Returns: `void` ### set method Signature ```typescript set(index: number, value: T, addMissingFields?: boolean): void; ``` Parameters | Parameter | Type | Description | | --- | --- | --- | | index | number | | | value | T | | | addMissingFields | boolean | | Returns: `void` ### toJSON method The simplified JSON values used in JSON.stringify() Signature ```typescript toJSON(): DataFrameDTO; ``` Returns: `DataFrameDTO` ### validate method Signature ```typescript validate(): void; ``` Returns: `void`