func AsJSON() Option {
	return func(table *Table) {
		table.Builder.TablePanel.Transform = "json"
	}
}
AsJSON displays the data as JSON.
package table
import (
	"github.com/K-Phoen/grabana/target/graphite"
	"github.com/K-Phoen/grabana/target/influxdb"
	"github.com/K-Phoen/grabana/target/prometheus"
	"github.com/grafana-tools/sdk"
)
type Option func(table *Table)
type AggregationType string
const (
	AVG AggregationType = "avg"
	Count AggregationType = "count"
	Current AggregationType = "current"
	Min AggregationType = "min"
	Max AggregationType = "max"
)
type Aggregation struct {
	Label string
	Type  AggregationType
}
type Table struct {
	Builder *sdk.Panel
}
func New(title string, options ...Option) *Table {
	panel := &Table{Builder: sdk.NewTable(title)}
	empty := ""
	panel.Builder.IsNew = false
	panel.Builder.TablePanel.Styles = []sdk.ColumnStyle{
		{
			Alias:   &empty,
			Pattern: "/.*/",
			Type:    "string",
		},
	}
	for _, opt := range append(defaults(), options...) {
		opt(panel)
	}
	return panel
}
func defaults() []Option {
	return []Option{
		Span(6),
		TimeSeriesToRows(),
	}
}
func WithPrometheusTarget(query string, options ...prometheus.Option) Option {
	target := prometheus.New(query, options...)
	return func(table *Table) {
		table.Builder.AddTarget(&sdk.Target{
			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(table *Table) {
		table.Builder.AddTarget(target.Builder)
	}
}
func WithInfluxDBTarget(query string, options ...influxdb.Option) Option {
	target := influxdb.New(query, options...)
	return func(table *Table) {
		table.Builder.AddTarget(target.Builder)
	}
}
func HideColumn(columnLabelPattern string) Option {
	return func(table *Table) {
		table.Builder.TablePanel.Styles = append([]sdk.ColumnStyle{
			{
				Pattern: columnLabelPattern,
				Type:    "hidden",
			},
		}, table.Builder.TablePanel.Styles...)
	}
}
func TimeSeriesToRows() Option {
	return func(table *Table) {
		table.Builder.TablePanel.Transform = "timeseries_to_rows"
	}
}
func TimeSeriesToColumns() Option {
	return func(table *Table) {
		table.Builder.TablePanel.Transform = "timeseries_to_columns"
	}
}