graph

package
v0.0.0-...-0ce9163 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

README

package graph

import "github.com/vivint/rothko/draw/graph"

package graph provides implementations of drawing rothko graphs.

Usage

type DrawOptions
type DrawOptions struct {
	// Canvas is where the drawing happens. It is expected to be large enough
	// to handle the drawing. If the canvas is nil or too small, one is
	// allocated.
	Canvas *draw.RGB

	// Columns is the set of columns to draw on the graph.
	Columns []draw.Column

	// Colors used for the heatmap.
	Colors []draw.Color
}

DrawOptions are all the ways you can configure the graph.

type MeasureOptions
type MeasureOptions struct {
	// Earliest is the distribution for the earliest (closest to Now) column.
	Earliest dist.Dist

	// What time the far right of the graph represents.
	Now int64

	// Duration is the amount of history the graph represents from now.
	Duration time.Duration

	// The width of the graph
	Width int

	// The height of the graph
	Height int

	// Padding around the graph
	Padding int
}

MeasureOptions are options for the graph to be measured.

type Measured
type Measured struct {
	// Bottom measured axis.
	Bottom axis.Measured

	// Observation measured axis.
	Obs observations.Measured

	// Right measured axis. Only valid if Earliest was passed with the
	// MeasureOptions.
	Right axis.Measured

	// Left measured axis.
	Left axis.Measured

	// Width, Height of the heatmap
	Width, Height int

	// The X,Y coordinates of the top left corner of the heatmap.
	X, Y int
}

Measured is a measured graph ready to be drawn when given data.

func Measure
func Measure(ctx context.Context, opts MeasureOptions) (Measured, bool)

Measure determines the sizes of the graph for the given parameters.

func (Measured) Draw
func (m Measured) Draw(ctx context.Context, opts DrawOptions) *draw.RGB

Documentation

Overview

package graph provides implementations of drawing rothko graphs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DrawOptions

type DrawOptions struct {
	// Canvas is where the drawing happens. It is expected to be large enough
	// to handle the drawing. If the canvas is nil or too small, one is
	// allocated.
	Canvas *draw.RGB

	// Columns is the set of columns to draw on the graph.
	Columns []draw.Column

	// Colors used for the heatmap.
	Colors []draw.Color
}

DrawOptions are all the ways you can configure the graph.

type MeasureOptions

type MeasureOptions struct {
	// Earliest is the distribution for the earliest (closest to Now) column.
	Earliest dist.Dist

	// What time the far right of the graph represents.
	Now int64

	// Duration is the amount of history the graph represents from now.
	Duration time.Duration

	// The width of the graph
	Width int

	// The height of the graph
	Height int

	// Padding around the graph
	Padding int
}

MeasureOptions are options for the graph to be measured.

type Measured

type Measured struct {
	// Bottom measured axis.
	Bottom axis.Measured

	// Observation measured axis.
	Obs observations.Measured

	// Right measured axis. Only valid if Earliest was passed with the
	// MeasureOptions.
	Right axis.Measured

	// Left measured axis.
	Left axis.Measured

	// Width, Height of the heatmap
	Width, Height int

	// The X,Y coordinates of the top left corner of the heatmap.
	X, Y int
	// contains filtered or unexported fields
}

Measured is a measured graph ready to be drawn when given data.

func Measure

func Measure(ctx context.Context, opts MeasureOptions) (Measured, bool)

Measure determines the sizes of the graph for the given parameters.

func (Measured) Draw

func (m Measured) Draw(ctx context.Context, opts DrawOptions) *draw.RGB

Jump to

Keyboard shortcuts

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