gauge

package
v0.21.18 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gauge

type Gauge struct {
	Builder *sdk.Panel
}

Gauge represents a stat panel.

func New

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

New creates a new gauge panel.

type Option

type Option func(gauge *Gauge) error

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

func AbsoluteThresholds

func AbsoluteThresholds(steps []ThresholdStep) Option

AbsoluteThresholds changes the background and value colors dynamically within the panel, depending on the value. The threshold is defined by a series of steps values which, each having a value and an associated color.

func ColorScheme

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 panel.

func Decimals

func Decimals(count int) Option

Decimals sets the number of decimals that should be displayed.

func Description

func Description(content string) Option

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

func Height

func Height(height string) Option

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

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

Links adds links to be displayed on this panel.

func NoValue

func NoValue(text string) Option

NoValue defines what to show when there is no value.

func Orientation

func Orientation(mode OrientationMode) Option

Orientation changes the orientation of the layout.

func RelativeThresholds

func RelativeThresholds(steps []ThresholdStep) Option

RelativeThresholds changes the background and value colors dynamically within the panel, depending on the value. The threshold is defined by a series of steps values which, each having a value defined as a percentage and an associated color.

func Repeat

func Repeat(repeat string) Option

Repeat configures repeating a panel for a variable

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 TitleFontSize

func TitleFontSize(size int) Option

TitleFontSize sets the font size used to display the title.

func Transparent

func Transparent() Option

Transparent makes the background transparent.

func Unit

func Unit(unit string) Option

Unit sets the unit of the data displayed on this axis.

func ValueFontSize

func ValueFontSize(size int) Option

ValueFontSize sets the font size used to display the value.

func ValueType

func ValueType(valueType ReductionType) Option

ValueType configures how the series will be reduced to a single value.

func WithGraphiteTarget

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

WithGraphiteTarget adds a Graphite target to the graph.

func WithInfluxDBTarget

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

func WithStackdriverTarget(target *stackdriver.Stackdriver) Option

WithStackdriverTarget adds a stackdriver query to the graph.

type OrientationMode

type OrientationMode string

OrientationMode controls the layout.

const (
	OrientationAuto       OrientationMode = ""
	OrientationHorizontal OrientationMode = "horizontal"
	OrientationVertical   OrientationMode = "vertical"
)

type RangeMap

type RangeMap struct {
	From string
	To   string
	Text string
}

RangeMap allows to map a range of values into explicit text.

type ReductionType

type ReductionType int

ReductionType lets you set the function that your entire query is reduced into a single value with.

const (
	// Min displays the smallest value of the series.
	Min ReductionType = iota
	// 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 ThresholdStep

type ThresholdStep struct {
	Color string
	Value *float64
}

type ValueMap

type ValueMap struct {
	Value string
	Text  string
}

ValueMap allows to map a value into explicit text.

Jump to

Keyboard shortcuts

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