diagram

package module
v0.0.0-...-3c00c8e Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2020 License: MIT Imports: 7 Imported by: 0

README

diagram

diagram is a library for programmatically creating diagrams

Everything here is subject to change.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int32sToFloat64s

func Int32sToFloat64s(xs []int32) []float64

func Int64sToFloat64s

func Int64sToFloat64s(xs []int64) []float64

func IntsToFloat64s

func IntsToFloat64s(xs []int) []float64

Types

type Canvas

type Canvas interface {
	Bounds() Rect
	Layer(index int) Canvas
	Clip(r Rect) Canvas
	Context(r Rect) Canvas
	Text(text string, at Point, style *Style)
	Poly(points []Point, style *Style)
	Rect(r Rect, style *Style)
}

type Length

type Length = float64

type Point

type Point struct{ X, Y Length }

func P

func P(x, y Length) Point

func Points

func Points(x, y []float64) []Point

func Ps

func Ps(cs ...Length) []Point

func (Point) Add

func (a Point) Add(b Point) Point

func (Point) Empty

func (a Point) Empty() bool

func (Point) Max

func (a Point) Max(b Point) Point

func (Point) Min

func (a Point) Min(b Point) Point

func (Point) Neg

func (a Point) Neg() Point

func (Point) Scale

func (a Point) Scale(v float64) Point

func (Point) Sub

func (a Point) Sub(b Point) Point

func (Point) XY

func (a Point) XY() (x, y Length)

type Rect

type Rect struct{ Min, Max Point }

func R

func R(x0, y0, x1, y1 Length) Rect

func (Rect) Column

func (r Rect) Column(i, count int) Rect

func (Rect) Empty

func (r Rect) Empty() bool

func (Rect) Inset

func (r Rect) Inset(by Rect) Rect

func (Rect) Offset

func (r Rect) Offset(by Point) Rect

func (Rect) Points

func (r Rect) Points() []Point

func (Rect) Row

func (r Rect) Row(i, count int) Rect

func (Rect) Shrink

func (r Rect) Shrink(radius Point) Rect

func (Rect) Size

func (r Rect) Size() Point

func (Rect) UnitLocation

func (r Rect) UnitLocation(u Point) Point

func (Rect) Zero

func (r Rect) Zero() Rect

type SVG

type SVG struct {
	Style string
	// contains filtered or unexported fields
}

func NewSVG

func NewSVG(width, height Length) *SVG

func (*SVG) Bounds

func (svg *SVG) Bounds() Rect

func (*SVG) Bytes

func (svg *SVG) Bytes() []byte

func (*SVG) Clip

func (svg *SVG) Clip(r Rect) Canvas

func (*SVG) Context

func (svg *SVG) Context(r Rect) Canvas

func (*SVG) Layer

func (svg *SVG) Layer(index int) Canvas

func (*SVG) Poly

func (svg *SVG) Poly(points []Point, style *Style)

func (*SVG) Rect

func (svg *SVG) Rect(r Rect, style *Style)

func (*SVG) Size

func (svg *SVG) Size() Point

func (*SVG) Text

func (svg *SVG) Text(text string, at Point, style *Style)

func (*SVG) WriteTo

func (svg *SVG) WriteTo(dst io.Writer) (n int64, err error)

type Style

type Style struct {
	Stroke color.Color
	Fill   color.Color
	Size   Length

	// line only
	Dash       []Length
	DashOffset []Length

	// text only
	Font     string
	Rotation float64
	Origin   Point // {-1..1, -1..1}

	// SVG
	Hint  string
	Class string
}

func (*Style) IsZero

func (style *Style) IsZero() bool

func (*Style) Or

func (style *Style) Or(other Style) *Style

Directories

Path Synopsis
cmd
testplot
testplot allows plotting `go test -json` output as a cascade to see testing parallelism and sequencing.
testplot allows plotting `go test -json` output as a cascade to see testing parallelism and sequencing.

Jump to

Keyboard shortcuts

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