tsplot

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultColors_HighContrast = ColorPalette{
		Foreground: colornames.White,
		Background: colornames.Black,
		GridColor:  colornames.Darkgrey,
		LineColors: []color.Color{
			color.RGBA{
				R: 0xe6,
				G: 0x9f,
				B: 0x00,
				A: 0xff,
			},
			color.RGBA{
				R: 0x56,
				G: 0xb4,
				B: 0xe9,
				A: 0xff,
			},
			color.RGBA{
				R: 0x00,
				G: 0x9e,
				B: 0x73,
				A: 0xff,
			},
			color.RGBA{
				R: 0xf0,
				G: 0xe4,
				B: 0x42,
				A: 0xff,
			},
			color.RGBA{
				R: 0x00,
				G: 0x72,
				B: 0xb2,
				A: 0x00,
			},
			color.RGBA{
				R: 0xd5,
				G: 0x5e,
				B: 0x00,
				A: 0xff,
			},
			color.RGBA{
				R: 0xcc,
				G: 0x79,
				B: 0xa7,
				A: 0xff,
			},
		},
	}
)

Functions

func ApplyDefaultHighContrast

func ApplyDefaultHighContrast(p *plot.Plot)

ApplyDefaultHighContrast applies the default high contrast color scheme to the *plot.Plot.

func NewPlotFromTimeSeries added in v1.0.0

func NewPlotFromTimeSeries(ts *monitoringpb.TimeSeries, opts ...PlotOption) (*plot.Plot, error)

NewPlotFromTimeSeries creates a plot from a single time series.

func NewPlotFromTimeSeriesIterator added in v1.0.0

func NewPlotFromTimeSeriesIterator(tsi *monitoring.TimeSeriesIterator, legendKey string, opts ...PlotOption) (*plot.Plot, error)

NewPlotFromTimeSeriesIterator creates a plot from multiple time series.

Types

type ColorPalette

type ColorPalette struct {
	Foreground color.Color
	Background color.Color
	GridColor  color.Color
	LineColors []color.Color
}

type PlotOption

type PlotOption func(p *plot.Plot)

PlotOption defines the type used to configure the underlying *plot.Plot. A function that returns PlotOption can be used to set options on the *plot.Plot.

func WithBackground

func WithBackground(color color.Color) PlotOption

WithBackground sets the background color on the *plot.Plot.

func WithColoredLineFromPoints added in v1.0.0

func WithColoredLineFromPoints(pts []*monitoringpb.Point, color color.Color) PlotOption

func WithFontSize added in v1.0.0

func WithFontSize(size float64) PlotOption

WithFontSize configures the font sizes for the plot's Title, Axis', and Legend.

func WithForeground

func WithForeground(color color.Color) PlotOption

WithForeground sets the foreground colors of the *plot.Plot to the provided color.

func WithGrid

func WithGrid(color color.Color) PlotOption

WithGrid adds a grid to the *plot.Plot and sets the color.

func WithLegend

func WithLegend(color color.Color) PlotOption

WithLegend sets the text color of the legend.

func WithLineFromPoints added in v1.0.0

func WithLineFromPoints(pts []*monitoringpb.Point) PlotOption

WithLineFromPoints creates a *plotter.Line from the passed in data points and adds it to the plot.

func WithSansFont added in v1.0.3

func WithSansFont() PlotOption

WithFontSize configures the font variant as Sans-Serif

func WithTitle

func WithTitle(title string) PlotOption

WithTitle configures the title text of the *plot.Plot.

func WithXAxisName

func WithXAxisName(name string) PlotOption

WithXAxisName sets the name of the X Axis.

func WithXTimeTicks

func WithXTimeTicks(format string) PlotOption

WithXTimeTicks configures the format for the tick marks on the X Axis.

func WithYAxisName

func WithYAxisName(name string) PlotOption

WithYAxisName sets the name of the Y Axis.

Jump to

Keyboard shortcuts

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