observations

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: 6 Imported by: 0

README

package observations

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

package observations provides drawing of an observations axis.

Usage

func Draw
func Draw(ctx context.Context, cols []draw.Column, opts Options) *draw.RGB

Draw renders the axis and returns a canvas allocated for the appopriate size. See Measure if you want to control where and how it is drawn.

type Measured
type Measured struct {
	// Width is the width in pixels of the observation axis
	Width int

	// Height is the height in pixels of the observation axis
	Height int
}

Measured represents a measured observations axis.

func Measure
func Measure(ctx context.Context, opts Options) Measured

Measure measures the axis sizes, and returns some state that can be used to draw on to some canvas.

func (Measured) Draw
func (m Measured) Draw(ctx context.Context, cols []draw.Column,
	canvas *draw.RGB) *draw.RGB

Draw performs the drawing of the data on to the canvas. The canvas is expected to be large enough to handle the drawing. If the canvas is nil, one is allocated. In either case, the canvas is returned.

type Options
type Options struct {
	// Face is the font face to use for rendering the max observations number.
	Face font.Face

	// Width is how long the axis is.
	Width int

	// Height is the height of the bar
	Height int
}

Options describe the axis rendering options.

Documentation

Overview

package observations provides drawing of an observations axis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Draw

func Draw(ctx context.Context, cols []draw.Column, opts Options) *draw.RGB

Draw renders the axis and returns a canvas allocated for the appopriate size. See Measure if you want to control where and how it is drawn.

Types

type Measured

type Measured struct {
	// Width is the width in pixels of the observation axis
	Width int

	// Height is the height in pixels of the observation axis
	Height int
	// contains filtered or unexported fields
}

Measured represents a measured observations axis.

func Measure

func Measure(ctx context.Context, opts Options) Measured

Measure measures the axis sizes, and returns some state that can be used to draw on to some canvas.

func (Measured) Draw

func (m Measured) Draw(ctx context.Context, cols []draw.Column,
	canvas *draw.RGB) *draw.RGB

Draw performs the drawing of the data on to the canvas. The canvas is expected to be large enough to handle the drawing. If the canvas is nil, one is allocated. In either case, the canvas is returned.

type Options

type Options struct {
	// Face is the font face to use for rendering the max observations number.
	Face font.Face

	// Width is how long the axis is.
	Width int

	// Height is the height of the bar
	Height int
}

Options describe the axis rendering options.

Jump to

Keyboard shortcuts

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