Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions grafonnet/gauge_panel.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* @param showThresholdLabels (default `false`) Render the threshold values around the gauge bar.
* @param showThresholdMarkers (default `true`) Render the thresholds as an outer bar.
* @param unit (default `'percent'`) Panel unit field option.
* @param fieldTitle (optional) Field title. May contain template variables (e.g. ${__series.name}).
* @param min (optional) Leave empty to calculate based on all values.
* @param max (optional) Leave empty to calculate based on all values.
* @param decimals Number of decimal places to show.
Expand Down Expand Up @@ -50,6 +51,7 @@
showThresholdLabels=false,
showThresholdMarkers=true,
unit='percent',
fieldTitle=null,
min=0,
max=100,
decimals=null,
Expand Down Expand Up @@ -177,6 +179,7 @@
mode: thresholdsMode,
steps: [],
},
[if fieldTitle != null then 'title']: fieldTitle,
mappings: [],
links: [],
},
Expand Down
6 changes: 6 additions & 0 deletions tests/gauge_panel/test.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@ local gaugePanel = grafana.gaugePanel;
{ color: 'yellow', value: 50 },
{ color: 'red', value: 80 },
]),
field_title_grafana6:
gaugePanel.new(
'',
pluginVersion='6.6.0',
fieldTitle='${__series.name}',
),
}
32 changes: 32 additions & 0 deletions tests/gauge_panel/test_compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,38 @@
"transparent": false,
"type": "gauge"
},
"field_title_grafana6": {
"datasource": null,
"links": [ ],
"options": {
"fieldOptions": {
"calcs": [
"mean"
],
"defaults": {
"links": [ ],
"mappings": [ ],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [ ]
},
"title": "${__series.name}",
"unit": "percent"
},
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "6.6.0",
"targets": [ ],
"title": "",
"transparent": false,
"type": "gauge"
},
"thresholds": {
"datasource": null,
"fieldConfig": {
Expand Down