graph

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 8 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DrawMode added in v0.2.0

type DrawMode uint8

DrawMode represents a type of visualization that will be drawn in the graph (lines, bars, points)

const (
	// Bars will display bars.
	Bars DrawMode = iota
	// Lines will display lines.
	Lines
	// Points will display points.
	Points
)

type Graph

type Graph struct {
	Builder *sdk.Panel
}

Graph represents a graph panel.

func New

func New(title string, options ...Option) *Graph

New creates a new graph panel.

type LegendOption added in v0.2.0

type LegendOption uint16

LegendOption allows to configure a legend.

const (
	// Hide keeps the legend from being displayed.
	Hide LegendOption = iota
	// AsTable displays the legend as a table.
	AsTable
	// ToTheRight displays the legend on the right side of the graph.
	ToTheRight
	// Min displays the smallest value of the series.
	Min
	// Max displays the largest value of the series.
	Max
	// Avg displays the average of the series.
	Avg
	// Current displays the current value of the series.
	Current
	// Total displays the total value of the series.
	Total
	// NoNullSeries hides series with only null values from the legend.
	NoNullSeries
	// NoZeroSeries hides series with only 0 values from the legend.
	NoZeroSeries
)

type NullValue added in v0.2.0

type NullValue string

NullValue describes how null values are displayed.

const (
	// AsZero treats null values as zero values.
	AsZero NullValue = "null as zero"

	// AsNull treats null values as null.
	AsNull NullValue = "null"

	// Connected connects null values.
	Connected NullValue = "connected"
)

type Option

type Option func(graph *Graph)

Option represents an option that can be used to configure a graph panel.

func Alert

func Alert(name string, opts ...alert.Option) Option

Alert creates an alert for this graph.

func DataSource

func DataSource(source string) Option

DataSource sets the data source to be used by the graph.

func Description added in v0.13.2

func Description(content string) Option

Description annotates the current visualization with a human-readable description.

func Draw added in v0.2.0

func Draw(modes ...DrawMode) Option

Draw specifies how the graph will be drawn.

func Fill added in v0.2.0

func Fill(value int) Option

Fill defines the amount of color fill for a series (default 1, max 10, 0 is none).

func Height

func Height(height string) Option

Height sets the height of the panel, in pixels. Example: "400px".

func LeftYAxis

func LeftYAxis(opts ...axis.Option) Option

LeftYAxis configures the left Y axis.

func Legend added in v0.2.0

func Legend(opts ...LegendOption) Option

Legend defines what should be shown in the legend.

func LineWidth added in v0.2.0

func LineWidth(value uint) Option

LineWidth defines the width of the line for a series (default 1, max 10, 0 is none).

func Null added in v0.2.0

func Null(mode NullValue) Option

Null configures how null values are displayed.

func PointRadius added in v0.2.0

func PointRadius(value float32) Option

PointRadius adjusts the size of points when Points are selected as Draw Mode.

func Repeat added in v0.17.0

func Repeat(repeat string) Option

Repeat configures repeating a panel for a variable

func RightYAxis

func RightYAxis(opts ...axis.Option) Option

RightYAxis configures the right Y axis.

func SeriesOverride added in v0.15.2

func SeriesOverride(opts ...series.OverrideOption) Option

SeriesOverride configures how null values are displayed. See https://grafana.com/docs/grafana/latest/panels/field-options/

func Span

func Span(span float32) Option

Span sets the width of the panel, in grid units. Should be a positive number between 1 and 12. Example: 6.

func Staircase added in v0.2.0

func Staircase() Option

Staircase draws adjacent points as staircase.

func Transparent added in v0.12.9

func Transparent() Option

Transparent makes the background transparent.

func WithGraphiteTarget added in v0.14.0

func WithGraphiteTarget(query string, options ...graphite.Option) Option

WithGraphiteTarget adds a Graphite target to the table.

func WithInfluxDBTarget added in v0.15.0

func WithInfluxDBTarget(query string, options ...influxdb.Option) Option

WithInfluxDBTarget adds an InfluxDB target to the graph.

func WithPrometheusTarget

func WithPrometheusTarget(query string, options ...prometheus.Option) Option

WithPrometheusTarget adds a prometheus query to the graph.

func WithStackdriverTarget added in v0.11.0

func WithStackdriverTarget(target *stackdriver.Stackdriver) Option

WithStackdriverTarget adds a stackdriver query to the graph.

func XAxis

func XAxis(opts ...axis.Option) Option

XAxis configures the X axis.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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