Documentation
¶
Index ¶
- func PanelConverter(input dashboard.Panel) string
- func PieChartLegendOptionsConverter(input PieChartLegendOptions) string
- func VariantConfig() variants.PanelcfgConfig
- type FieldConfig
- type Options
- type PanelBuilder
- func (builder *PanelBuilder) Build() (dashboard.Panel, error)
- func (builder *PanelBuilder) CacheTimeout(cacheTimeout string) *PanelBuilder
- func (builder *PanelBuilder) ColorScheme(color cog.Builder[dashboard.FieldColor]) *PanelBuilder
- func (builder *PanelBuilder) DataLinks(links []cog.Builder[dashboard.DashboardLink]) *PanelBuilder
- func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *PanelBuilder
- func (builder *PanelBuilder) Decimals(decimals float64) *PanelBuilder
- func (builder *PanelBuilder) Description(description string) *PanelBuilder
- func (builder *PanelBuilder) DisplayLabels(displayLabels []PieChartLabels) *PanelBuilder
- func (builder *PanelBuilder) DisplayName(displayName string) *PanelBuilder
- func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder
- func (builder *PanelBuilder) Height(h uint32) *PanelBuilder
- func (builder *PanelBuilder) HideFrom(hideFrom cog.Builder[common.HideSeriesConfig]) *PanelBuilder
- func (builder *PanelBuilder) HideTimeOverride(hideTimeOverride bool) *PanelBuilder
- func (builder *PanelBuilder) Id(id uint32) *PanelBuilder
- func (builder *PanelBuilder) Interval(interval string) *PanelBuilder
- func (builder *PanelBuilder) Legend(legend cog.Builder[PieChartLegendOptions]) *PanelBuilder
- func (builder *PanelBuilder) LibraryPanel(libraryPanel dashboard.LibraryPanelRef) *PanelBuilder
- func (builder *PanelBuilder) Links(links []cog.Builder[dashboard.DashboardLink]) *PanelBuilder
- func (builder *PanelBuilder) Mappings(mappings []dashboard.ValueMapping) *PanelBuilder
- func (builder *PanelBuilder) Max(max float64) *PanelBuilder
- func (builder *PanelBuilder) MaxDataPoints(maxDataPoints float64) *PanelBuilder
- func (builder *PanelBuilder) MaxPerRow(maxPerRow float64) *PanelBuilder
- func (builder *PanelBuilder) Min(min float64) *PanelBuilder
- func (builder *PanelBuilder) NoValue(noValue string) *PanelBuilder
- func (builder *PanelBuilder) Orientation(orientation common.VizOrientation) *PanelBuilder
- func (builder *PanelBuilder) Overrides(overrides []cog.Builder[dashboard.DashboardFieldConfigSourceOverrides]) *PanelBuilder
- func (builder *PanelBuilder) PieType(pieType PieChartType) *PanelBuilder
- func (builder *PanelBuilder) QueryCachingTTL(queryCachingTTL float64) *PanelBuilder
- func (builder *PanelBuilder) ReduceOptions(reduceOptions cog.Builder[common.ReduceDataOptions]) *PanelBuilder
- func (builder *PanelBuilder) Repeat(repeat string) *PanelBuilder
- func (builder *PanelBuilder) RepeatDirection(repeatDirection dashboard.PanelRepeatDirection) *PanelBuilder
- func (builder *PanelBuilder) Span(w uint32) *PanelBuilder
- func (builder *PanelBuilder) Targets(targets []cog.Builder[variants.Dataquery]) *PanelBuilder
- func (builder *PanelBuilder) Text(text cog.Builder[common.VizTextDisplayOptions]) *PanelBuilder
- func (builder *PanelBuilder) Thresholds(thresholds cog.Builder[dashboard.ThresholdsConfig]) *PanelBuilder
- func (builder *PanelBuilder) TimeFrom(timeFrom string) *PanelBuilder
- func (builder *PanelBuilder) TimeShift(timeShift string) *PanelBuilder
- func (builder *PanelBuilder) Title(title string) *PanelBuilder
- func (builder *PanelBuilder) Tooltip(tooltip cog.Builder[common.VizTooltipOptions]) *PanelBuilder
- func (builder *PanelBuilder) Transformations(transformations []dashboard.DataTransformerConfig) *PanelBuilder
- func (builder *PanelBuilder) Transparent(transparent bool) *PanelBuilder
- func (builder *PanelBuilder) Unit(unit string) *PanelBuilder
- func (builder *PanelBuilder) WithOverride(matcher dashboard.MatcherConfig, properties []dashboard.DynamicConfigValue) *PanelBuilder
- func (builder *PanelBuilder) WithTarget(target cog.Builder[variants.Dataquery]) *PanelBuilder
- func (builder *PanelBuilder) WithTransformation(transformation dashboard.DataTransformerConfig) *PanelBuilder
- type PieChartLabels
- type PieChartLegendOptions
- type PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) AsTable(asTable bool) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) Build() (PieChartLegendOptions, error)
- func (builder *PieChartLegendOptionsBuilder) Calcs(calcs []string) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) DisplayMode(displayMode common.LegendDisplayMode) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) IsVisible(isVisible bool) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) Placement(placement common.LegendPlacement) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) ShowLegend(showLegend bool) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) SortBy(sortBy string) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) SortDesc(sortDesc bool) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) Values(values []PieChartLegendValues) *PieChartLegendOptionsBuilder
- func (builder *PieChartLegendOptionsBuilder) Width(width float64) *PieChartLegendOptionsBuilder
- type PieChartLegendValues
- type PieChartType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PanelConverter ¶
PanelConverter accepts a `Panel` object and generates the Go code to build this object using builders.
func PieChartLegendOptionsConverter ¶
func PieChartLegendOptionsConverter(input PieChartLegendOptions) string
PieChartLegendOptionsConverter accepts a `PieChartLegendOptions` object and generates the Go code to build this object using builders.
func VariantConfig ¶
func VariantConfig() variants.PanelcfgConfig
VariantConfig returns the configuration related to piechart panels. This configuration describes how to unmarshal it, convert it to code, …
Types ¶
type FieldConfig ¶
type FieldConfig = common.HideableFieldConfig
func NewFieldConfig ¶
func NewFieldConfig() *FieldConfig
NewFieldConfig creates a new FieldConfig object.
type Options ¶
type Options struct { PieType PieChartType `json:"pieType"` DisplayLabels []PieChartLabels `json:"displayLabels,omitempty"` Tooltip common.VizTooltipOptions `json:"tooltip"` ReduceOptions common.ReduceDataOptions `json:"reduceOptions"` Text *common.VizTextDisplayOptions `json:"text,omitempty"` Legend PieChartLegendOptions `json:"legend"` Orientation common.VizOrientation `json:"orientation"` }
func (*Options) UnmarshalJSONStrict ¶
UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `Options` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …
type PanelBuilder ¶
type PanelBuilder struct {
// contains filtered or unexported fields
}
Dashboard panels are the basic visualization building blocks.
func NewPanelBuilder ¶
func NewPanelBuilder() *PanelBuilder
func (*PanelBuilder) CacheTimeout ¶
func (builder *PanelBuilder) CacheTimeout(cacheTimeout string) *PanelBuilder
Sets panel queries cache timeout.
func (*PanelBuilder) ColorScheme ¶
func (builder *PanelBuilder) ColorScheme(color cog.Builder[dashboard.FieldColor]) *PanelBuilder
Panel color configuration
func (*PanelBuilder) DataLinks ¶
func (builder *PanelBuilder) DataLinks(links []cog.Builder[dashboard.DashboardLink]) *PanelBuilder
The behavior when clicking on a result
func (*PanelBuilder) Datasource ¶
func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *PanelBuilder
The datasource used in all targets.
func (*PanelBuilder) Decimals ¶
func (builder *PanelBuilder) Decimals(decimals float64) *PanelBuilder
Specify the number of decimals Grafana includes in the rendered value. If you leave this field blank, Grafana automatically truncates the number of decimals based on the value. For example 1.1234 will display as 1.12 and 100.456 will display as 100. To display all decimals, set the unit to `String`.
func (*PanelBuilder) Description ¶
func (builder *PanelBuilder) Description(description string) *PanelBuilder
Panel description.
func (*PanelBuilder) DisplayLabels ¶
func (builder *PanelBuilder) DisplayLabels(displayLabels []PieChartLabels) *PanelBuilder
func (*PanelBuilder) DisplayName ¶
func (builder *PanelBuilder) DisplayName(displayName string) *PanelBuilder
The display value for this field. This supports template variables blank is auto
func (*PanelBuilder) GridPos ¶
func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder
Grid position.
func (*PanelBuilder) Height ¶
func (builder *PanelBuilder) Height(h uint32) *PanelBuilder
Panel height. The height is the number of rows from the top edge of the panel.
func (*PanelBuilder) HideFrom ¶
func (builder *PanelBuilder) HideFrom(hideFrom cog.Builder[common.HideSeriesConfig]) *PanelBuilder
func (*PanelBuilder) HideTimeOverride ¶
func (builder *PanelBuilder) HideTimeOverride(hideTimeOverride bool) *PanelBuilder
Controls if the timeFrom or timeShift overrides are shown in the panel header
func (*PanelBuilder) Id ¶
func (builder *PanelBuilder) Id(id uint32) *PanelBuilder
Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.
func (*PanelBuilder) Interval ¶
func (builder *PanelBuilder) Interval(interval string) *PanelBuilder
The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables. This value must be formatted as a number followed by a valid time identifier like: "40s", "3d", etc. See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
func (*PanelBuilder) Legend ¶
func (builder *PanelBuilder) Legend(legend cog.Builder[PieChartLegendOptions]) *PanelBuilder
func (*PanelBuilder) LibraryPanel ¶
func (builder *PanelBuilder) LibraryPanel(libraryPanel dashboard.LibraryPanelRef) *PanelBuilder
Dynamically load the panel
func (*PanelBuilder) Links ¶
func (builder *PanelBuilder) Links(links []cog.Builder[dashboard.DashboardLink]) *PanelBuilder
Panel links.
func (*PanelBuilder) Mappings ¶
func (builder *PanelBuilder) Mappings(mappings []dashboard.ValueMapping) *PanelBuilder
Convert input values into a display string
func (*PanelBuilder) Max ¶
func (builder *PanelBuilder) Max(max float64) *PanelBuilder
The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
func (*PanelBuilder) MaxDataPoints ¶
func (builder *PanelBuilder) MaxDataPoints(maxDataPoints float64) *PanelBuilder
The maximum number of data points that the panel queries are retrieving.
func (*PanelBuilder) MaxPerRow ¶
func (builder *PanelBuilder) MaxPerRow(maxPerRow float64) *PanelBuilder
Option for repeated panels that controls max items per row Only relevant for horizontally repeated panels
func (*PanelBuilder) Min ¶
func (builder *PanelBuilder) Min(min float64) *PanelBuilder
The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.
func (*PanelBuilder) NoValue ¶
func (builder *PanelBuilder) NoValue(noValue string) *PanelBuilder
Alternative to empty string
func (*PanelBuilder) Orientation ¶
func (builder *PanelBuilder) Orientation(orientation common.VizOrientation) *PanelBuilder
func (*PanelBuilder) Overrides ¶
func (builder *PanelBuilder) Overrides(overrides []cog.Builder[dashboard.DashboardFieldConfigSourceOverrides]) *PanelBuilder
Overrides are the options applied to specific fields overriding the defaults.
func (*PanelBuilder) PieType ¶
func (builder *PanelBuilder) PieType(pieType PieChartType) *PanelBuilder
func (*PanelBuilder) QueryCachingTTL ¶
func (builder *PanelBuilder) QueryCachingTTL(queryCachingTTL float64) *PanelBuilder
Overrides the data source configured time-to-live for a query cache item in milliseconds
func (*PanelBuilder) ReduceOptions ¶
func (builder *PanelBuilder) ReduceOptions(reduceOptions cog.Builder[common.ReduceDataOptions]) *PanelBuilder
func (*PanelBuilder) Repeat ¶
func (builder *PanelBuilder) Repeat(repeat string) *PanelBuilder
Name of template variable to repeat for.
func (*PanelBuilder) RepeatDirection ¶
func (builder *PanelBuilder) RepeatDirection(repeatDirection dashboard.PanelRepeatDirection) *PanelBuilder
Direction to repeat in if 'repeat' is set. `h` for horizontal, `v` for vertical.
func (*PanelBuilder) Span ¶
func (builder *PanelBuilder) Span(w uint32) *PanelBuilder
Panel width. The width is the number of columns from the left edge of the panel.
func (*PanelBuilder) Targets ¶
func (builder *PanelBuilder) Targets(targets []cog.Builder[variants.Dataquery]) *PanelBuilder
Depends on the panel plugin. See the plugin documentation for details.
func (*PanelBuilder) Text ¶
func (builder *PanelBuilder) Text(text cog.Builder[common.VizTextDisplayOptions]) *PanelBuilder
func (*PanelBuilder) Thresholds ¶
func (builder *PanelBuilder) Thresholds(thresholds cog.Builder[dashboard.ThresholdsConfig]) *PanelBuilder
Map numeric values to states
func (*PanelBuilder) TimeFrom ¶
func (builder *PanelBuilder) TimeFrom(timeFrom string) *PanelBuilder
Overrides the relative time range for individual panels, which causes them to be different than what is selected in the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different time periods or days on the same dashboard. The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far), `now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years). Note: Panel time overrides have no effect when the dashboard’s time range is absolute. See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
func (*PanelBuilder) TimeShift ¶
func (builder *PanelBuilder) TimeShift(timeShift string) *PanelBuilder
Overrides the time range for individual panels by shifting its start and end relative to the time picker. For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`. Note: Panel time overrides have no effect when the dashboard’s time range is absolute. See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
func (*PanelBuilder) Title ¶
func (builder *PanelBuilder) Title(title string) *PanelBuilder
Panel title.
func (*PanelBuilder) Tooltip ¶
func (builder *PanelBuilder) Tooltip(tooltip cog.Builder[common.VizTooltipOptions]) *PanelBuilder
func (*PanelBuilder) Transformations ¶
func (builder *PanelBuilder) Transformations(transformations []dashboard.DataTransformerConfig) *PanelBuilder
List of transformations that are applied to the panel data before rendering. When there are multiple transformations, Grafana applies them in the order they are listed. Each transformation creates a result set that then passes on to the next transformation in the processing pipeline.
func (*PanelBuilder) Transparent ¶
func (builder *PanelBuilder) Transparent(transparent bool) *PanelBuilder
Whether to display the panel without a background.
func (*PanelBuilder) Unit ¶
func (builder *PanelBuilder) Unit(unit string) *PanelBuilder
Unit a field should use. The unit you select is applied to all fields except time. You can use the units ID availables in Grafana or a custom unit. Available units in Grafana: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/valueFormats/categories.ts As custom unit, you can use the following formats: `suffix:<suffix>` for custom unit that should go after value. `prefix:<prefix>` for custom unit that should go before value. `time:<format>` For custom date time formats type for example `time:YYYY-MM-DD`. `si:<base scale><unit characters>` for custom SI units. For example: `si: mF`. This one is a bit more advanced as you can specify both a unit and the source data scale. So if your source data is represented as milli (thousands of) something prefix the unit with that SI scale character. `count:<unit>` for a custom count unit. `currency:<unit>` for custom a currency unit.
func (*PanelBuilder) WithOverride ¶
func (builder *PanelBuilder) WithOverride(matcher dashboard.MatcherConfig, properties []dashboard.DynamicConfigValue) *PanelBuilder
Overrides are the options applied to specific fields overriding the defaults.
func (*PanelBuilder) WithTarget ¶
func (builder *PanelBuilder) WithTarget(target cog.Builder[variants.Dataquery]) *PanelBuilder
Depends on the panel plugin. See the plugin documentation for details.
func (*PanelBuilder) WithTransformation ¶
func (builder *PanelBuilder) WithTransformation(transformation dashboard.DataTransformerConfig) *PanelBuilder
List of transformations that are applied to the panel data before rendering. When there are multiple transformations, Grafana applies them in the order they are listed. Each transformation creates a result set that then passes on to the next transformation in the processing pipeline.
type PieChartLabels ¶
type PieChartLabels string
Select labels to display on the pie chart.
- Name - The series or field name.
- Percent - The percentage of the whole.
- Value - The raw numerical value.
const ( PieChartLabelsName PieChartLabels = "name" PieChartLabelsValue PieChartLabels = "value" PieChartLabelsPercent PieChartLabels = "percent" )
type PieChartLegendOptions ¶
type PieChartLegendOptions struct { Values []PieChartLegendValues `json:"values"` DisplayMode common.LegendDisplayMode `json:"displayMode"` Placement common.LegendPlacement `json:"placement"` ShowLegend bool `json:"showLegend"` AsTable *bool `json:"asTable,omitempty"` IsVisible *bool `json:"isVisible,omitempty"` SortBy *string `json:"sortBy,omitempty"` SortDesc *bool `json:"sortDesc,omitempty"` Width *float64 `json:"width,omitempty"` Calcs []string `json:"calcs"` }
func NewPieChartLegendOptions ¶
func NewPieChartLegendOptions() *PieChartLegendOptions
NewPieChartLegendOptions creates a new PieChartLegendOptions object.
func (PieChartLegendOptions) Equals ¶
func (resource PieChartLegendOptions) Equals(other PieChartLegendOptions) bool
Equals tests the equality of two `PieChartLegendOptions` objects.
func (*PieChartLegendOptions) UnmarshalJSONStrict ¶
func (resource *PieChartLegendOptions) UnmarshalJSONStrict(raw []byte) error
UnmarshalJSONStrict implements a custom JSON unmarshalling logic to decode `PieChartLegendOptions` from JSON. Note: the unmarshalling done by this function is strict. It will fail over required fields being absent from the input, fields having an incorrect type, unexpected fields being present, …
func (PieChartLegendOptions) Validate ¶
func (resource PieChartLegendOptions) Validate() error
Validate checks all the validation constraints that may be defined on `PieChartLegendOptions` fields for violations and returns them.
type PieChartLegendOptionsBuilder ¶
type PieChartLegendOptionsBuilder struct {
// contains filtered or unexported fields
}
func NewPieChartLegendOptionsBuilder ¶
func NewPieChartLegendOptionsBuilder() *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) AsTable ¶
func (builder *PieChartLegendOptionsBuilder) AsTable(asTable bool) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) Build ¶
func (builder *PieChartLegendOptionsBuilder) Build() (PieChartLegendOptions, error)
func (*PieChartLegendOptionsBuilder) Calcs ¶
func (builder *PieChartLegendOptionsBuilder) Calcs(calcs []string) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) DisplayMode ¶
func (builder *PieChartLegendOptionsBuilder) DisplayMode(displayMode common.LegendDisplayMode) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) IsVisible ¶
func (builder *PieChartLegendOptionsBuilder) IsVisible(isVisible bool) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) Placement ¶
func (builder *PieChartLegendOptionsBuilder) Placement(placement common.LegendPlacement) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) ShowLegend ¶
func (builder *PieChartLegendOptionsBuilder) ShowLegend(showLegend bool) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) SortBy ¶
func (builder *PieChartLegendOptionsBuilder) SortBy(sortBy string) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) SortDesc ¶
func (builder *PieChartLegendOptionsBuilder) SortDesc(sortDesc bool) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) Values ¶
func (builder *PieChartLegendOptionsBuilder) Values(values []PieChartLegendValues) *PieChartLegendOptionsBuilder
func (*PieChartLegendOptionsBuilder) Width ¶
func (builder *PieChartLegendOptionsBuilder) Width(width float64) *PieChartLegendOptionsBuilder
type PieChartLegendValues ¶
type PieChartLegendValues string
Select values to display in the legend.
- Percent: The percentage of the whole.
- Value: The raw numerical value.
const ( PieChartLegendValuesValue PieChartLegendValues = "value" PieChartLegendValuesPercent PieChartLegendValues = "percent" )
type PieChartType ¶
type PieChartType string
Select the pie chart display style.
const ( PieChartTypePie PieChartType = "pie" PieChartTypeDonut PieChartType = "donut" )