Skip to content

PanelBuilderπŸ”—

ConstructorπŸ”—

func NewPanelBuilder() *PanelBuilder

MethodsπŸ”—

BuildπŸ”—

Builds the object.

func (builder *PanelBuilder) Build() (dashboard.Panel, error)

AxisBorderShowπŸ”—

func (builder *PanelBuilder) AxisBorderShow(axisBorderShow bool) *PanelBuilder

AxisCenteredZeroπŸ”—

func (builder *PanelBuilder) AxisCenteredZero(axisCenteredZero bool) *PanelBuilder

AxisColorModeπŸ”—

func (builder *PanelBuilder) AxisColorMode(axisColorMode common.AxisColorMode) *PanelBuilder

AxisGridShowπŸ”—

func (builder *PanelBuilder) AxisGridShow(axisGridShow bool) *PanelBuilder

AxisLabelπŸ”—

func (builder *PanelBuilder) AxisLabel(axisLabel string) *PanelBuilder

AxisPlacementπŸ”—

func (builder *PanelBuilder) AxisPlacement(axisPlacement common.AxisPlacement) *PanelBuilder

AxisSoftMaxπŸ”—

func (builder *PanelBuilder) AxisSoftMax(axisSoftMax float64) *PanelBuilder

AxisSoftMinπŸ”—

func (builder *PanelBuilder) AxisSoftMin(axisSoftMin float64) *PanelBuilder

AxisWidthπŸ”—

func (builder *PanelBuilder) AxisWidth(axisWidth float64) *PanelBuilder

BarRadiusπŸ”—

Controls the radius of each bar.

func (builder *PanelBuilder) BarRadius(barRadius float64) *PanelBuilder

BarWidthπŸ”—

Controls the width of bars. 1 = Max width, 0 = Min width.

func (builder *PanelBuilder) BarWidth(barWidth float64) *PanelBuilder

CacheTimeoutπŸ”—

Sets panel queries cache timeout.

func (builder *PanelBuilder) CacheTimeout(cacheTimeout string) *PanelBuilder

ColorByFieldπŸ”—

Use the color value for a sibling field to color each bar value.

func (builder *PanelBuilder) ColorByField(colorByField string) *PanelBuilder

ColorSchemeπŸ”—

Panel color configuration

func (builder *PanelBuilder) ColorScheme(color cog.Builder[dashboard.FieldColor]) *PanelBuilder

DatasourceπŸ”—

The datasource used in all targets.

func (builder *PanelBuilder) Datasource(datasource dashboard.DataSourceRef) *PanelBuilder

DecimalsπŸ”—

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 (builder *PanelBuilder) Decimals(decimals float64) *PanelBuilder

DescriptionπŸ”—

Panel description.

func (builder *PanelBuilder) Description(description string) *PanelBuilder

DisplayNameπŸ”—

The display value for this field. This supports template variables blank is auto

func (builder *PanelBuilder) DisplayName(displayName string) *PanelBuilder

FillOpacityπŸ”—

Controls the fill opacity of the bars.

func (builder *PanelBuilder) FillOpacity(fillOpacity int32) *PanelBuilder

FullHighlightπŸ”—

Enables mode which highlights the entire bar area and shows tooltip when cursor

hovers over highlighted area

func (builder *PanelBuilder) FullHighlight(fullHighlight bool) *PanelBuilder

GradientModeπŸ”—

Set the mode of the gradient fill. Fill gradient is based on the line color. To change the color, use the standard color scheme field option.

Gradient appearance is influenced by the Fill opacity setting.

func (builder *PanelBuilder) GradientMode(gradientMode common.GraphGradientMode) *PanelBuilder

GridPosπŸ”—

Grid position.

func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder

GroupWidthπŸ”—

Controls the width of groups. 1 = max with, 0 = min width.

func (builder *PanelBuilder) GroupWidth(groupWidth float64) *PanelBuilder

HeightπŸ”—

Panel height. The height is the number of rows from the top edge of the panel.

func (builder *PanelBuilder) Height(h uint32) *PanelBuilder

HideFromπŸ”—

func (builder *PanelBuilder) HideFrom(hideFrom cog.Builder[common.HideSeriesConfig]) *PanelBuilder

HideTimeOverrideπŸ”—

Controls if the timeFrom or timeShift overrides are shown in the panel header

func (builder *PanelBuilder) HideTimeOverride(hideTimeOverride bool) *PanelBuilder

IdπŸ”—

Unique identifier of the panel. Generated by Grafana when creating a new panel. It must be unique within a dashboard, but not globally.

func (builder *PanelBuilder) Id(id uint32) *PanelBuilder

IntervalπŸ”—

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 (builder *PanelBuilder) Interval(interval string) *PanelBuilder

LegendπŸ”—

func (builder *PanelBuilder) Legend(legend cog.Builder[common.VizLegendOptions]) *PanelBuilder

LibraryPanelπŸ”—

Dynamically load the panel

func (builder *PanelBuilder) LibraryPanel(libraryPanel dashboard.LibraryPanelRef) *PanelBuilder

LineWidthπŸ”—

Controls line width of the bars.

func (builder *PanelBuilder) LineWidth(lineWidth int32) *PanelBuilder

Panel links.

func (builder *PanelBuilder) Links(links []cog.Builder[dashboard.DashboardLink]) *PanelBuilder

MappingsπŸ”—

Convert input values into a display string

func (builder *PanelBuilder) Mappings(mappings []dashboard.ValueMapping) *PanelBuilder

MaxπŸ”—

The maximum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.

func (builder *PanelBuilder) Max(max float64) *PanelBuilder

MaxDataPointsπŸ”—

The maximum number of data points that the panel queries are retrieving.

func (builder *PanelBuilder) MaxDataPoints(maxDataPoints float64) *PanelBuilder

MaxPerRowπŸ”—

Option for repeated panels that controls max items per row

Only relevant for horizontally repeated panels

func (builder *PanelBuilder) MaxPerRow(maxPerRow float64) *PanelBuilder

MinπŸ”—

The minimum value used in percentage threshold calculations. Leave blank for auto calculation based on all series and fields.

func (builder *PanelBuilder) Min(min float64) *PanelBuilder

NoValueπŸ”—

Alternative to empty string

func (builder *PanelBuilder) NoValue(noValue string) *PanelBuilder

OrientationπŸ”—

Controls the orientation of the bar chart, either vertical or horizontal.

func (builder *PanelBuilder) Orientation(orientation common.VizOrientation) *PanelBuilder

OverridesπŸ”—

Overrides are the options applied to specific fields overriding the defaults.

func (builder *PanelBuilder) Overrides(overrides []cog.Builder[dashboard.DashboardFieldConfigSourceOverrides]) *PanelBuilder

QueryCachingTTLπŸ”—

Overrides the data source configured time-to-live for a query cache item in milliseconds

func (builder *PanelBuilder) QueryCachingTTL(queryCachingTTL float64) *PanelBuilder

RepeatπŸ”—

Name of template variable to repeat for.

func (builder *PanelBuilder) Repeat(repeat string) *PanelBuilder

RepeatDirectionπŸ”—

Direction to repeat in if 'repeat' is set.

h for horizontal, v for vertical.

func (builder *PanelBuilder) RepeatDirection(repeatDirection dashboard.PanelRepeatDirection) *PanelBuilder

ScaleDistributionπŸ”—

func (builder *PanelBuilder) ScaleDistribution(scaleDistribution cog.Builder[common.ScaleDistributionConfig]) *PanelBuilder

ShowValueπŸ”—

This controls whether values are shown on top or to the left of bars.

func (builder *PanelBuilder) ShowValue(showValue common.VisibilityMode) *PanelBuilder

SpanπŸ”—

Panel width. The width is the number of columns from the left edge of the panel.

func (builder *PanelBuilder) Span(w uint32) *PanelBuilder

StackingπŸ”—

Controls whether bars are stacked or not, either normally or in percent mode.

func (builder *PanelBuilder) Stacking(stacking common.StackingMode) *PanelBuilder

TargetsπŸ”—

Depends on the panel plugin. See the plugin documentation for details.

func (builder *PanelBuilder) Targets(targets []cog.Builder[cog/variants.Dataquery]) *PanelBuilder

TextπŸ”—

func (builder *PanelBuilder) Text(text cog.Builder[common.VizTextDisplayOptions]) *PanelBuilder

ThresholdsπŸ”—

Map numeric values to states

func (builder *PanelBuilder) Thresholds(thresholds cog.Builder[dashboard.ThresholdsConfig]) *PanelBuilder

ThresholdsStyleπŸ”—

Threshold rendering

func (builder *PanelBuilder) ThresholdsStyle(thresholdsStyle cog.Builder[common.GraphThresholdsStyleConfig]) *PanelBuilder

TimeFromπŸ”—

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 (builder *PanelBuilder) TimeFrom(timeFrom string) *PanelBuilder

TimeShiftπŸ”—

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 (builder *PanelBuilder) TimeShift(timeShift string) *PanelBuilder

TitleπŸ”—

Panel title.

func (builder *PanelBuilder) Title(title string) *PanelBuilder

TooltipπŸ”—

func (builder *PanelBuilder) Tooltip(tooltip cog.Builder[common.VizTooltipOptions]) *PanelBuilder

TransformationsπŸ”—

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 (builder *PanelBuilder) Transformations(transformations []dashboard.DataTransformerConfig) *PanelBuilder

TransparentπŸ”—

Whether to display the panel without a background.

func (builder *PanelBuilder) Transparent(transparent bool) *PanelBuilder

UnitπŸ”—

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 (builder *PanelBuilder) Unit(unit string) *PanelBuilder

WithOverrideπŸ”—

Overrides are the options applied to specific fields overriding the defaults.

func (builder *PanelBuilder) WithOverride(matcher dashboard.MatcherConfig, properties []dashboard.DynamicConfigValue) *PanelBuilder

WithTargetπŸ”—

Depends on the panel plugin. See the plugin documentation for details.

func (builder *PanelBuilder) WithTarget(target cog.Builder[cog/variants.Dataquery]) *PanelBuilder

WithTransformationπŸ”—

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 (builder *PanelBuilder) WithTransformation(transformation dashboard.DataTransformerConfig) *PanelBuilder

XFieldπŸ”—

Manually select which field from the dataset to represent the x field.

func (builder *PanelBuilder) XField(xField string) *PanelBuilder

XTickLabelMaxLengthπŸ”—

Sets the max length that a label can have before it is truncated.

func (builder *PanelBuilder) XTickLabelMaxLength(xTickLabelMaxLength int32) *PanelBuilder

XTickLabelRotationπŸ”—

Controls the rotation of the x axis labels.

func (builder *PanelBuilder) XTickLabelRotation(xTickLabelRotation int32) *PanelBuilder

XTickLabelSpacingπŸ”—

Controls the spacing between x axis labels.

negative values indicate backwards skipping behavior

func (builder *PanelBuilder) XTickLabelSpacing(xTickLabelSpacing int32) *PanelBuilder

See alsoπŸ”—