plot

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlueShades = []WeightedColor{
	{Value: 0.0, Color: color.RGBA{0xea, 0xf8, 0xfd, 1}},
	{Value: 0.1, Color: color.RGBA{0xbf, 0xeb, 0xfa, 1}},
	{Value: 0.2, Color: color.RGBA{0x94, 0xdd, 0xf6, 1}},
	{Value: 0.3, Color: color.RGBA{0x69, 0xd0, 0xf2, 1}},
	{Value: 0.4, Color: color.RGBA{0x3f, 0xc2, 0xef, 1}},
	{Value: 0.5, Color: color.RGBA{0x14, 0xb5, 0xeb, 1}},
	{Value: 0.6, Color: color.RGBA{0x10, 0x94, 0xc0, 1}},
	{Value: 0.7, Color: color.RGBA{0x0d, 0x73, 0x96, 1}},
	{Value: 0.8, Color: color.RGBA{0x09, 0x52, 0x6b, 1}},
	{Value: 0.9, Color: color.RGBA{0x05, 0x31, 0x40, 1}},
	{Value: 1.0, Color: color.RGBA{0x02, 0x10, 0x15, 1}},
}

https://mdigi.tools/color-shades/

View Source
var GreenShades = []WeightedColor{
	{Value: 0.0, Color: color.RGBA{0xed, 0xf7, 0xf2, 0}},
	{Value: 0.1, Color: color.RGBA{0xc9, 0xe8, 0xd7, 0}},
	{Value: 0.2, Color: color.RGBA{0xa5, 0xd9, 0xbc, 0}},
	{Value: 0.3, Color: color.RGBA{0x81, 0xca, 0xa2, 0}},
	{Value: 0.4, Color: color.RGBA{0x5e, 0xbb, 0x87, 0}},
	{Value: 0.5, Color: color.RGBA{0x44, 0xa1, 0x6e, 0}},
	{Value: 0.6, Color: color.RGBA{0x35, 0x7e, 0x55, 0}},
	{Value: 0.7, Color: color.RGBA{0x26, 0x5a, 0x3d, 0}},
	{Value: 0.8, Color: color.RGBA{0x17, 0x36, 0x25, 0}},
	{Value: 0.9, Color: color.RGBA{0x08, 0x12, 0x0c, 0}},
	{Value: 1.0, Color: color.RGBA{0x00, 0x00, 0x00, 0}},
}
View Source
var PinkShades = []WeightedColor{
	{Value: 0.0, Color: color.RGBA{0xfe, 0xe7, 0xf3, 1}},
	{Value: 0.1, Color: color.RGBA{0xfc, 0xb6, 0xdc, 1}},
	{Value: 0.2, Color: color.RGBA{0xf9, 0x85, 0xc5, 1}},
	{Value: 0.3, Color: color.RGBA{0xf7, 0x55, 0xae, 1}},
	{Value: 0.4, Color: color.RGBA{0xf5, 0x24, 0x96, 1}},
	{Value: 0.5, Color: color.RGBA{0xdb, 0x0a, 0x7d, 1}},
	{Value: 0.6, Color: color.RGBA{0xaa, 0x08, 0x61, 1}},
	{Value: 0.7, Color: color.RGBA{0x7a, 0x06, 0x45, 1}},
	{Value: 0.8, Color: color.RGBA{0x49, 0x03, 0x2a, 1}},
	{Value: 0.9, Color: color.RGBA{0x18, 0x01, 0x0e, 1}},
	{Value: 1.0, Color: color.RGBA{0x00, 0x00, 0x00, 1}},
}

Functions

func IsReservedPlotName added in v0.6.0

func IsReservedPlotName(name string) bool

func RGBString

func RGBString(r, g, b uint8) string

Types

type Config

type Config struct {
	// Series contains the plots we want to show and how we want to show them.
	Series []any `json:"series"`
	// Events contains a list of 'events time series' names. Series with
	// these names must be sent alongside other series. An event time series
	// is just made of timestamps with no associated value, each of which
	// gets plotted as a vertical line over another plot.
	Events []string `json:"events"`
}

type HeapmapHover

type HeapmapHover struct {
	YName string `json:"yname"`
	YUnit string `json:"yunit"` // 'duration', 'bytes' or custom
	ZName string `json:"zname"`
}

type Heatmap

type Heatmap struct {
	Name       string          `json:"name"`
	Title      string          `json:"title"`
	Type       string          `json:"type"`
	UpdateFreq int             `json:"updateFreq"`
	InfoText   string          `json:"infoText"`
	Events     string          `json:"events"`
	Layout     HeatmapLayout   `json:"layout"`
	Colorscale []WeightedColor `json:"colorscale"`
	Buckets    []float64       `json:"buckets"`
	CustomData []float64       `json:"custom_data"`
	Hover      HeapmapHover    `json:"hover"`
}

type HeatmapLayout added in v0.6.0

type HeatmapLayout struct {
	YAxis HeatmapYaxis `json:"yaxis"`
}

type HeatmapUserPlot added in v0.6.0

type HeatmapUserPlot struct {
	Plot Heatmap
}

type HeatmapYaxis added in v0.6.0

type HeatmapYaxis struct {
	Title    string    `json:"title"`
	TickMode string    `json:"tickmode"`
	TickVals []float64 `json:"tickvals"`
	TickText []float64 `json:"ticktext"`
}

type List

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

List holds all the plots that statsviz knows about. Some plots might be disabled, if they rely on metrics that are unknown to the current Go version.

func NewList added in v0.6.0

func NewList(userPlots []UserPlot) (*List, error)

func (*List) Config

func (pl *List) Config() *Config

func (*List) WriteValues

func (pl *List) WriteValues(w io.Writer) error

WriteValues writes into w a JSON object containing the data points for all plots at the current instant.

type Scatter

type Scatter struct {
	Name       string        `json:"name"`
	Title      string        `json:"title"`
	Type       string        `json:"type"`
	UpdateFreq int           `json:"updateFreq"`
	InfoText   string        `json:"infoText"`
	Events     string        `json:"events"`
	Layout     ScatterLayout `json:"layout"`
	Subplots   []Subplot     `json:"subplots"`
}

type ScatterLayout added in v0.6.0

type ScatterLayout struct {
	Yaxis   ScatterYAxis `json:"yaxis"`
	BarMode string       `json:"barmode"`
}

type ScatterUserPlot added in v0.6.0

type ScatterUserPlot struct {
	Plot  Scatter
	Funcs []func() float64
}

type ScatterYAxis added in v0.6.0

type ScatterYAxis struct {
	Title      string `json:"title"`
	TickSuffix string `json:"ticksuffix"`
}

type Subplot

type Subplot struct {
	Name       string `json:"name"`
	Unitfmt    string `json:"unitfmt"`
	StackGroup string `json:"stackgroup"`
	HoverOn    string `json:"hoveron"`
	Color      string `json:"color"`
	Type       string `json:"type"`
}

type UserPlot added in v0.6.0

type UserPlot struct {
	Scatter *ScatterUserPlot
	Heatmap *HeatmapUserPlot
}

func (UserPlot) Layout added in v0.6.0

func (up UserPlot) Layout() any

type WeightedColor

type WeightedColor struct {
	Value float64
	Color color.RGBA
}

func (WeightedColor) MarshalJSON

func (c WeightedColor) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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