graph

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Axis

type Axis struct {
	gui.Item
	gui.Area

	layout.Axis
	// contains filtered or unexported fields
}

Axis is an axis element for graphs

func NewAxisX

func NewAxisX(label string, start f32.Point, length float32) *Axis

NewAxisX creates a new x axis

func NewAxisY

func NewAxisY(label string, start f32.Point, length float32) *Axis

NewAxisY creates a new y axis

func (Axis) Delimiters

func (axis Axis) Delimiters(delim int, calc math.Mapper) []*Delimiter

func (*Axis) Draw

func (a *Axis) Draw(gtx *layout.Context, th *material.Theme) error

Draw draws the axis

type Chart

type Chart struct {
	math.CoordinateMapper
	canvas.Container
	// contains filtered or unexported fields
}

Chart is a graph object designed to hold all the graph contents as child elements

func NewChart

func NewChart(labels []string, rect *f32.Rectangle) *Chart

NewChart creates a new graph

func (*Chart) AddCollection

func (g *Chart) AddCollection(title string, col model.Collection, active bool) canvas.Control

AddCollection adds a series model collection to the graph

func (*Chart) AddPoint

func (g *Chart) AddPoint(label string, p f32.Point, color color.RGBA, control canvas.Control) uint32

AddPoint adds a point to the graph

func (*Chart) Axis

func (g *Chart) Axis()

func (*Chart) AxisX

func (g *Chart) AxisX(label string) (*Axis, []*Delimiter)

AxisX adds an x axis to the graph

func (*Chart) AxisY

func (g *Chart) AxisY(label string) (*Axis, []*Delimiter)

AxisY adds a y axis to the graph

func (*Chart) Draw

func (g *Chart) Draw(gtx *layout.Context, th *material.Theme) error

func (*Chart) Refresh

func (g *Chart) Refresh()

func (*Chart) RemoveAxis

func (g *Chart) RemoveAxis()

type Delimiter

type Delimiter struct {
	gui.Item
	canvas.DynamicElement
	// contains filtered or unexported fields
}

Delimiter is an axis child element representing a value on the respective axis

func NewDelimiterX

func NewDelimiterX(p f32.Point, transform math.Transform) *Delimiter

NewDelimiterX creates a new delimiter for an x axis

func NewDelimiterY

func NewDelimiterY(p f32.Point, transform math.Transform) *Delimiter

NewDelimiterY creates a new delimiter for an x axis

func (*Delimiter) Draw

func (d *Delimiter) Draw(gtx *layout.Context, th *material.Theme) error

Draw draws the delimiter

type Point

type Point struct {
	gui.Item
	*canvas.RawDynamicElement
	// contains filtered or unexported fields
}

AddPoint is a point element

func NewPoint

func NewPoint(label string, center f32.Point, cc color.RGBA) *Point

NewPoint creates a new point

func (*Point) Draw

func (p *Point) Draw(gtx *layout.Context, th *material.Theme) error

Draw draws the point on the canvas

Jump to

Keyboard shortcuts

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