buffer

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package buffer contain buffers used with charts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Float64PointScaleBuffer

type Float64PointScaleBuffer struct {
	// contains filtered or unexported fields
}

Float64PointScaleBuffer is a variable size buffer that stores Float64Points and a scaled version of the Float64Points. Scaling is done by multiplying incoming values (X,Y) coordinates by a constant scale factor.

func NewFloat64PointScaleBuffer

func NewFloat64PointScaleBuffer(o, sc canvas.Float64Point) *Float64PointScaleBuffer

NewFloat64PointScaleBuffer returns *Float64PointScaleBuffer initialized to default settings.

func (*Float64PointScaleBuffer) At

At returns Float64Point of scaled data at index i of buffer.

func (*Float64PointScaleBuffer) AtRaw

AtRaw returns Float64Point of original data at index i of buffer.

func (*Float64PointScaleBuffer) Clear

func (b *Float64PointScaleBuffer) Clear()

Clear resets buffer contents.

func (*Float64PointScaleBuffer) Length

func (b *Float64PointScaleBuffer) Length() int

Length returns number of data in buffer.

func (*Float64PointScaleBuffer) Offset

Offset returns Float64Point used to subtract data points from.

func (*Float64PointScaleBuffer) Pop

func (b *Float64PointScaleBuffer) Pop()

Pop erases the oldest Float64Point from the buffer.

func (*Float64PointScaleBuffer) Push

Push adds Float64Point data to the back of the buffer.

func (*Float64PointScaleBuffer) ReadAll

ReadAll returns entire scaled data buffer.

func (*Float64PointScaleBuffer) ReadAllRaw

func (b *Float64PointScaleBuffer) ReadAllRaw() []canvas.Float64Point

ReadAllRaw returns entire original data buffer.

func (*Float64PointScaleBuffer) Scale

Scale returns Float64Point used to multiple data points by.

func (*Float64PointScaleBuffer) SetData

SetData sets contents of internal buffer to given []float64 and scales the data.

func (*Float64PointScaleBuffer) SetOffset

SetOffset updates offsets and recomputes all scaled data.

func (*Float64PointScaleBuffer) SetScale

SetScale updates scaling factor and recomputes all scaled data.

type Float64ScaleBuffer

type Float64ScaleBuffer struct {
	// contains filtered or unexported fields
}

Float64ScaleBuffer is a variable size buffer that stores float64 data values and a scaled version of the data. Scaling is done by multiplying incoming values by a constant scale factor.

func NewFloat64ScaleBuffer

func NewFloat64ScaleBuffer(o, sc float64) *Float64ScaleBuffer

NewFloat64ScaleBuffer returns *Float64ScaleBuffer initialized to default settings.

func (*Float64ScaleBuffer) At

func (b *Float64ScaleBuffer) At(i int) float64

At returns Float64Point of scaled data at index i of buffer.

func (*Float64ScaleBuffer) AtRaw

func (b *Float64ScaleBuffer) AtRaw(i int) float64

AtRaw returns Float64Point of original data at index i of buffer.

func (*Float64ScaleBuffer) Clear

func (b *Float64ScaleBuffer) Clear()

Clear resets buffer contents.

func (*Float64ScaleBuffer) Length

func (b *Float64ScaleBuffer) Length() int

Length returns number of data in buffer.

func (*Float64ScaleBuffer) Offset

func (b *Float64ScaleBuffer) Offset() float64

Offset returns data value offset.

func (*Float64ScaleBuffer) Pop

func (b *Float64ScaleBuffer) Pop()

Pop erases the oldest Float64Point from the buffer.

func (*Float64ScaleBuffer) Push

func (b *Float64ScaleBuffer) Push(p float64)

Push adds Float64Point data to the back of the buffer.

func (*Float64ScaleBuffer) ReadAll

func (b *Float64ScaleBuffer) ReadAll() []float64

ReadAll returns entire scaled data buffer.

func (*Float64ScaleBuffer) ReadAllRaw

func (b *Float64ScaleBuffer) ReadAllRaw() []float64

ReadAllRaw returns entire original data buffer.

func (*Float64ScaleBuffer) Scale

func (b *Float64ScaleBuffer) Scale() float64

Scale returns scaling factor.

func (*Float64ScaleBuffer) SetData

func (b *Float64ScaleBuffer) SetData(d []float64)

SetData sets contents of internal buffer to given []float64 and scales the data.

func (*Float64ScaleBuffer) SetOffset

func (b *Float64ScaleBuffer) SetOffset(o float64)

SetOffset updates offset and recomputes all scaled data.

func (*Float64ScaleBuffer) SetScale

func (b *Float64ScaleBuffer) SetScale(sc float64)

SetScale updates scaling factor and recomputes all scaled data.

type Float64ScaleRingBuffer

type Float64ScaleRingBuffer struct {
	// contains filtered or unexported fields
}

Float64ScaleRingBuffer is a fix-sized ring buffer that stores float64 data values and a scaled version of the data. Scaling is done by first subtracting by the offset and then multiplying incoming values by a constant scale factor. Unlike traditional ring buffers, pushing data to the buffer while at full capacity will erase the oldest datum from the buffer to create room for writing.

func NewFloat64ScaleRingBuffer

func NewFloat64ScaleRingBuffer(s int, o, sc float64) *Float64ScaleRingBuffer

NewFloat64ScaleRingBuffer returns *Float64ScaleRingBuffer initialized to default settings.

func (*Float64ScaleRingBuffer) Clear

func (b *Float64ScaleRingBuffer) Clear()

Clear resets buffer contents.

func (*Float64ScaleRingBuffer) Length

func (b *Float64ScaleRingBuffer) Length() int

Length returns number of data in buffer.

func (*Float64ScaleRingBuffer) Offset

func (b *Float64ScaleRingBuffer) Offset() float64

Offset returns data value offset.

func (*Float64ScaleRingBuffer) Pop

func (b *Float64ScaleRingBuffer) Pop()

Pop erases the oldest float64 from the buffer.

func (*Float64ScaleRingBuffer) Push

func (b *Float64ScaleRingBuffer) Push(f float64)

Push adds float64 data to the back of the buffer.

func (*Float64ScaleRingBuffer) ReadAll

func (b *Float64ScaleRingBuffer) ReadAll() []float64

ReadAll returns entire scaled data buffer.

func (*Float64ScaleRingBuffer) ReadAllRaw

func (b *Float64ScaleRingBuffer) ReadAllRaw() []float64

ReadAllRaw returns entire original data buffer.

func (*Float64ScaleRingBuffer) Scale

func (b *Float64ScaleRingBuffer) Scale() float64

Scale returns scaling factor.

func (*Float64ScaleRingBuffer) SetOffset

func (b *Float64ScaleRingBuffer) SetOffset(o float64)

SetOffset updates offset and recomputes all scaled data.

func (*Float64ScaleRingBuffer) SetScale

func (b *Float64ScaleRingBuffer) SetScale(sc float64)

SetScale updates scaling factor and recomputes all scaled data.

func (*Float64ScaleRingBuffer) Size

func (b *Float64ScaleRingBuffer) Size() int

Size returns buffer capacity.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL