timeseries

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 14 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BarAlignment

type BarAlignment int

BarAlignment defines how Grafana aligns bars.

const (
	// The bar is drawn around the point. The point is placed in the center of the bar.
	AlignCenter BarAlignment = 0
	// The bar is drawn before the point. The point is placed on the trailing corner of the bar.
	AlignBefore BarAlignment = -1
	// The bar is drawn after the point. The point is placed on the leading corner of the bar.
	AlignAfter BarAlignment = 1
)

type GradientType

type GradientType string

GradientType defines the mode of the gradient fill.

const (
	// No gradient fill.
	NoGradient GradientType = "none"
	// Transparency of the gradient is calculated based on the values on the y-axis.
	// Opacity of the fill is increasing with the values on the Y-axis.
	Opacity GradientType = "opacity"
	// Gradient color is generated based on the hue of the line color.
	Hue GradientType = "hue"
	// In this mode the whole bar will use a color gradient defined by the color scheme.
	Scheme GradientType = "scheme"
)

type LegendOption

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
	// AsList displays the legend as a list.
	AsList
	// Bottom displays the legend below the graph.
	Bottom
	// 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

	// First displays the first value of the series.
	First
	// FirstNonNull displays the first non-null value of the series.
	FirstNonNull
	// Last displays the last value of the series.
	Last
	// LastNonNull displays the last non-null value of the series.
	LastNonNull

	// Total displays the sum of values in the series.
	Total
	// Count displays the number of value in the series.
	Count
	// Range displays the difference between the minimum and maximum values.
	Range
)

type LineInterpolationMode

type LineInterpolationMode string

LineInterpolationMode defines how Grafana interpolates series lines when drawn as lines.

const (
	// Points are joined by straight lines.
	Linear LineInterpolationMode = "linear"
	// Points are joined by curved lines resulting in smooth transitions between points.
	Smooth LineInterpolationMode = "smooth"
	// The line is displayed as steps between points. Points are rendered at the end of the step.
	StepBefore LineInterpolationMode = "stepBefore"
	// Line is displayed as steps between points. Points are rendered at the beginning of the step.
	StepAfter LineInterpolationMode = "stepAfter"
)

type Option

type Option func(timeseries *TimeSeries) error

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 Axis

func Axis(options ...axis.Option) Option

Axis configures the axis for this time series.

func Bars

func Bars(alignment BarAlignment) Option

Bars displays the series as bars, with a given alignment strategy.

func ColorScheme added in v0.20.15

func ColorScheme(options ...scheme.Option) Option

ColorScheme configures the color scheme.

func DataSource

func DataSource(source string) Option

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

func Description

func Description(content string) Option

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

func FieldOverride added in v0.20.13

func FieldOverride(m fields.Matcher, opts ...fields.OverrideOption) Option

FieldOverride allows overriding visualization options.

func FillOpacity

func FillOpacity(value int) Option

FillOpacity defines the opacity level of the series. The lower the value, the more transparent.

func GradientMode

func GradientMode(mode GradientType) Option

GradientMode sets the mode of the gradient fill.

func Height

func Height(height string) Option

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

func Legend

func Legend(opts ...LegendOption) Option

Legend defines what should be shown in the legend.

func LineWidth

func LineWidth(value int) Option

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

func Lines

func Lines(mode LineInterpolationMode) Option

Lines displays the series as lines, with a given interpolation strategy.

func Links(panelLinks ...links.Link) Option

Links adds links to be displayed on this panel.

func PointSize

func PointSize(value int) Option

PointSize adjusts the size of points.

func Points

func Points() Option

Points displays the series as points.

func Repeat

func Repeat(repeat string) Option

Repeat configures repeating a panel for a variable

func RepeatDirection added in v0.22.0

func RepeatDirection(direction sdk.RepeatDirection) Option

RepeatDirection configures repeating vertical or horizontal

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 Stack added in v0.21.13

func Stack(value StackMode) Option

Stack defines if the series should be stacked and using which mode (default not stacked).

func Thresholds added in v0.20.15

func Thresholds(options ...threshold.Option) Option

Thresholds configures the thresholds for this time series.

func Tooltip

func Tooltip(mode TooltipMode) Option

Tooltip configures the tooltip content.

func Transparent

func Transparent() Option

Transparent makes the background transparent.

func WithGraphiteTarget

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

WithGraphiteTarget adds a Graphite target to the table.

func WithInfluxDBTarget

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

WithInfluxDBTarget adds an InfluxDB target to the graph.

func WithLokiTarget added in v0.21.0

func WithLokiTarget(query string, options ...loki.Option) Option

WithLokiTarget adds a loki query to the graph.

func WithPrometheusTarget

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

WithPrometheusTarget adds a prometheus query to the graph.

func WithStackdriverTarget

func WithStackdriverTarget(target *stackdriver.Stackdriver) Option

WithStackdriverTarget adds a stackdriver query to the graph.

type StackMode added in v0.21.13

type StackMode string

StackMode configures mode of series stacking.

const (
	// Unstacked will not stack series
	Unstacked StackMode = "none"
	// NormalStack will stack series as absolute numbers
	NormalStack StackMode = "normal"
	// PercentStack will stack series as percents
	PercentStack StackMode = "percent"
)

type TimeSeries

type TimeSeries struct {
	Builder *sdk.Panel
	Alert   *alert.Alert
}

TimeSeries represents a time series panel.

func New

func New(title string, options ...Option) (*TimeSeries, error)

New creates a new time series panel.

type TooltipMode

type TooltipMode string

TooltipMode configures which series will be displayed in the tooltip.

const (
	// SingleSeries will only display the hovered series.
	SingleSeries TooltipMode = "single"
	// AllSeries will display all series.
	AllSeries TooltipMode = "multi"
	// NoSeries will hide the tooltip completely.
	NoSeries TooltipMode = "none"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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