func Description(content string) Option {
	return func(singleStat *SingleStat) {
		singleStat.Builder.Description = &content
	}
}
Description annotates the current visualization with a human-readable description.
package singlestat
import (
	"strings"
	"github.com/K-Phoen/grabana/target/graphite"
	"github.com/K-Phoen/grabana/target/influxdb"
	"github.com/K-Phoen/grabana/target/prometheus"
	"github.com/K-Phoen/grabana/target/stackdriver"
	"github.com/grafana-tools/sdk"
)
type Option func(stat *SingleStat)
type StatType string
const (
	Min StatType = "min"
	Max StatType = "max"
	Avg StatType = "avg"
	Current StatType = "current"
	Total StatType = "total"
	First StatType = "first"
	Delta StatType = "delta"
	Diff StatType = "diff"
	Range StatType = "range"
	Name StatType = "name"
)
type ValueMap struct {
	Value string
	Text  string
}
type RangeMap struct {
	From string
	To   string
	Text string
}
var valueToTextMapping = 1
var rangeToTextMapping = 2
type SingleStat struct {
	Builder *sdk.Panel
}
func New(title string, options ...Option) *SingleStat {
	panel := &SingleStat{Builder: sdk.NewSinglestat(title)}
	valueToText := "value to text"
	rangeToText := "range to text"
	panel.Builder.IsNew = false
	mappingType := uint(valueToTextMapping)
	panel.Builder.SinglestatPanel.MappingType = &mappingType
	panel.Builder.SinglestatPanel.MappingTypes = []*sdk.MapType{
		{
			Name:  &valueToText,
			Value: &valueToTextMapping,
		},
		{
			Name:  &rangeToText,
			Value: &rangeToTextMapping,
		},
	}
	panel.Builder.SinglestatPanel.SparkLine = sdk.SparkLine{}
	for _, opt := range append(defaults(), options...) {
		opt(panel)
	}
	return panel
}
func defaults() []Option {
	return []Option{
		Span(6),
		ValueFontSize("100%"),
		ValueType(Avg),
		Colors([3]string{"#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"}),
		ValuesToText([]ValueMap{
			{
				Value: "null",
				Text:  "N/A",
			},
		}),
		SparkLineColor("rgb(31, 120, 193)"),
		SparkLineFillColor("rgba(31, 118, 189, 0.18)"),
	}
}
func DataSource(source string) Option {
	return func(singleStat *SingleStat) {
		singleStat.Builder.Datasource = &source
	}
}
func WithPrometheusTarget(query string, options ...prometheus.Option) Option {
	target := prometheus.New(query, options...)
	return func(singleStat *SingleStat) {
		singleStat.Builder.AddTarget(&sdk.Target{
			RefID:          target.Ref,
			Expr:           target.Expr,
			IntervalFactor: target.IntervalFactor,
			Interval:       target.Interval,
			Step:           target.Step,
			LegendFormat:   target.LegendFormat,
			Instant:        target.Instant,
			Format:         target.Format,
		})
	}
}
func WithGraphiteTarget(query string, options ...graphite.Option) Option {
	target := graphite.New(query, options...)
	return func(singleStat *SingleStat) {
		singleStat.Builder.AddTarget(target.Builder)
	}
}
func WithInfluxDBTarget(query string, options ...influxdb.Option) Option {
	target := influxdb.New(query, options...)
	return func(singleStat *SingleStat) {
		singleStat.Builder.AddTarget(target.Builder)
	}
}
func WithStackdriverTarget(target *stackdriver.Stackdriver) Option {
	return func(singleStat *SingleStat) {
		singleStat.Builder.AddTarget(target.Builder)
	}
}
func Span(span float32) Option {
	return func(singleStat *SingleStat) {
		singleStat.Builder.Span = span
	}
}
func Height(height string) Option {
	return func(singleStat *SingleStat) {
		singleStat.Builder.Height = &height
	}
}