Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions grafonnet/bar_gauge_panel.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
* @param datasource (optional) Panel datasource.
* @param unit (optional) The unit of the data.
* @param thresholds (optional) An array of threashold values.
* @param values (optional) Bool if show values
* @param calcs (optional) An array of type of calculation
* @param fields (optional) string - fields that should be included in the panel
* @param orientation (optional) string (horizontal or vertical)
* @param displayMode (optional) string (eg. lcd)
* @param showUnfilled (optional) bool if showUnfilled
*
* @method addTarget(target) Adds a target object.
* @method addTargets(targets) Adds an array of targets.
Expand All @@ -19,6 +25,12 @@
datasource=null,
unit=null,
thresholds=[],
values=false,
calcs=['mean'],
fields='',
orientation='auto',
displayMode='gradient',
showUnfilled=true,
):: {
type: 'bargauge',
title: title,
Expand All @@ -43,5 +55,15 @@
targets+: [target { refId: std.char(std.codepoint('A') + nextTarget) }],
},
addTargets(targets):: std.foldl(function(p, t) p.addTarget(t), targets, self),
options: {
reduceOptions: {
values: values,
calcs: calcs,
fields: fields,
},
orientation: orientation,
displayMode: displayMode,
showUnfilled: showUnfilled,
},
},
}