Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana/v8.0/packages_api/data/circularvector.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana/v8.0/packages_api/data/circularvector/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
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.
CircularVector class
Circular vector uses a single buffer to capture a stream of values overwriting the oldest value on add.
This supports adding to the ‘head’ or ’tail’ and will grow the buffer to match a configured capacity.
Signature
export declare class CircularVector<T = any> extends FunctionalVector<T> implements MutableVector<T> Import
import { CircularVector } from '@grafana/data';Constructors
| Constructor | Modifiers | Description |
|---|---|---|
| constructor(options) | Constructs a new instance of the CircularVector class |
Properties
Methods
| Method | Modifiers | Description |
|---|---|---|
| get(index) | ||
| reverse() | ||
| set(index, value) | ||
| setAppendMode(mode) | ||
| setCapacity(v) | ||
| toArray() | ||
| toJSON() |
constructor(options)
Constructs a new instance of the CircularVector class
Signature
constructor(options: CircularOptions<T>);Parameters
| Parameter | Type | Description |
|---|---|---|
| options | CircularOptions<T> |
add property
Add the value to the buffer
Signature
add: (value: T) => void;length property
Signature
get length(): number;get method
Signature
get(index: number): T;Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number |
Returns:
T
reverse method
Signature
reverse(): void;Returns:
void
set method
Signature
set(index: number, value: T): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number | |
| value | T |
Returns:
void
setAppendMode method
Signature
setAppendMode(mode: 'head' | 'tail'): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| mode | ‘head’ | ’tail’ |
Returns:
void
setCapacity method
Signature
setCapacity(v: number): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| v | number |
Returns:
void
toArray method
Signature
toArray(): T[];Returns:
T[]
toJSON method
Signature
toJSON(): T[];Returns:
T[]