NewGauge: Fix segmented gauge with min value != 0 (#112697)

* NewGauge: Fix segmented gauge with min value != 0

* update gdev dashboard to exercise case

* update gdev dashboard with panel to exercise

* update

---------

Co-authored-by: Paul Marbach <paul.marbach@grafana.com>
This commit is contained in:
Torkel Ödegaard
2025-10-21 17:49:04 +02:00
committed by GitHub
co-authored by Paul Marbach
parent 5a798afb3f
commit 27ac08dd51
3 changed files with 199 additions and 80 deletions
@@ -37,8 +37,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -105,8 +104,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -174,8 +172,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "very small\n",
"fieldConfig": {
@@ -241,8 +238,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -311,8 +307,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -370,8 +365,7 @@
"targets": [
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"refId": "A",
"scenarioId": "no_data_points"
@@ -382,8 +376,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -451,8 +444,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -523,8 +515,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -598,8 +589,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -678,8 +668,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "",
"fieldConfig": {
@@ -744,8 +733,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"hide": false,
"refId": "B",
@@ -754,8 +742,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"hide": false,
"refId": "C",
@@ -764,8 +751,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"hide": false,
"refId": "D",
@@ -791,8 +777,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "should not show any threshold markers",
"fieldConfig": {
@@ -820,7 +805,7 @@
},
"gridPos": {
"h": 9,
"w": 15,
"w": 8,
"x": 0,
"y": 26
},
@@ -853,8 +838,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "should not show any threshold markers",
"fieldConfig": {
@@ -893,8 +877,8 @@
},
"gridPos": {
"h": 9,
"w": 9,
"x": 15,
"w": 8,
"x": 8,
"y": 26
},
"id": 2,
@@ -924,6 +908,84 @@
"title": "Many thresholds with labels",
"type": "gauge"
},
{
"datasource": {
"type": "grafana-testdata-datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"max": 90,
"min": 20,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "yellow",
"value": 30
},
{
"color": "orange",
"value": 50
},
{
"color": "red",
"value": 70
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 8,
"x": 16,
"y": 26
},
"id": 19,
"options": {
"barWidthFactor": 0.5,
"effects": {
"barGlow": false,
"centerGlow": false,
"rounded": false,
"spotlight": false
},
"gradient": "none",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"segmentCount": 70,
"segmentSpacing": 0.3,
"shape": "gauge",
"showThresholdLabels": false,
"showThresholdMarkers": true,
"sparkline": false
},
"pluginVersion": "12.3.0-pre",
"targets": [
{
"max": 90,
"min": 20,
"refId": "A",
"scenarioId": "random_walk"
}
],
"title": "Segmented w/ thresholds (min != 0, max != 100)",
"type": "gauge"
},
{
"collapsed": false,
"gridPos": {
@@ -939,8 +1001,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "should not show any threshold markers",
"fieldConfig": {
@@ -1012,8 +1073,7 @@
},
{
"datasource": {
"type": "grafana-testdata-datasource",
"uid": "PD8C576611E62080A"
"type": "grafana-testdata-datasource"
},
"description": "should not show any threshold markers",
"fieldConfig": {