+++
# -----------------------------------------------------------------------
# Do not edit this file. It is automatically generated by API Documenter.
# -----------------------------------------------------------------------
title = "CircularVector"
keywords = ["grafana","documentation","sdk","@grafana/data"]
type = "docs"
draft = true
+++
## CircularVector class
Circular vector uses a single buffer to capture a stream of values overwriting the oldest value on add.
This supports addting to the 'head' or 'tail' and will grow the buffer to match a configured capacity.
Signature
```typescript
export declare class CircularVector implements MutableVector
```
Import
```typescript
import { CircularVector } from '@grafana/data';
```
Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [constructor(options)](#constructor-options) | | Constructs a new instance of the CircularVector
class |
Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [add](#add-property) | | (value: T) => void
| Add the value to the buffer |
| [length](#length-property) | | number
| |
Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [get(index)](#get-method) | | |
| [reverse()](#reverse-method) | | |
| [set(index, value)](#set-method) | | |
| [setAppendMode(mode)](#setappendmode-method) | | |
| [setCapacity(v)](#setcapacity-method) | | |
| [toArray()](#toarray-method) | | |
| [toJSON()](#tojson-method) | | |
### constructor(options)
Constructs a new instance of the `CircularVector` class
Signature
```typescript
constructor(options: CircularOptions);
```
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | CircularOptions<T>
| |
### add property
Add the value to the buffer
Signature
```typescript
add: (value: T) => void;
```
### length property
Signature
```typescript
get length(): number;
```
### get method
Signature
```typescript
get(index: number): T;
```
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| index | number
| |
Returns:
`T`
### reverse method
Signature
```typescript
reverse(): void;
```
Returns:
`void`
### set method
Signature
```typescript
set(index: number, value: T): void;
```
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| index | number
| |
| value | T
| |
Returns:
`void`
### setAppendMode method
Signature
```typescript
setAppendMode(mode: 'head' | 'tail'): void;
```
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| mode | 'head' | 'tail'
| |
Returns:
`void`
### setCapacity method
Signature
```typescript
setCapacity(v: number): void;
```
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| v | number
| |
Returns:
`void`
### toArray method
Signature
```typescript
toArray(): T[];
```
Returns:
`T[]`
### toJSON method
Signature
```typescript
toJSON(): T[];
```
Returns:
`T[]`