StatPanel: ColorMode, GraphMode & JustifyMode changes (#20680)

* StatPanel: Options rethink

* Changed options to string based

* -Fixed tests

* Refactoring moving files

* Refactoring alignment factors

* Added alignment factors

* Added basic test

* Added unit test for layout

* Font size handling

* Font sizing works

* Progress on sizing

* Updated

* Minor update

* Updated

* Updated

* Removed line option

* updated

* Updated

* Updated

* Updated

* Highlight last point

* Fixed tests

* Code refactoring and cleanup

* updated

* Updated snapshot
This commit is contained in:
Torkel Ödegaard
2019-12-01 17:02:44 +01:00
committed by GitHub
parent fcde26e2db
commit 8894e2858c
23 changed files with 942 additions and 728 deletions
@@ -20,190 +20,15 @@
{
"datasource": null,
"gridPos": {
"h": 7,
"w": 20,
"h": 2,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"interval": "10m",
"options": {
"colorMode": 0,
"displayMode": 2,
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
"mappings": [],
"max": 100,
"min": 0,
"thresholds": [
{
"color": "blue",
"value": null
},
{
"color": "green",
"value": 10
},
{
"color": "purple",
"value": 20
},
{
"color": "orange",
"value": 40
},
{
"color": "red",
"value": 80
}
],
"unit": "percent"
},
"override": {},
"values": false
},
"orientation": "auto",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.5.0-pre",
"targets": [
{
"refId": "A",
"scenarioId": "random_walk"
},
{
"refId": "B",
"scenarioId": "random_walk"
},
{
"refId": "C",
"scenarioId": "random_walk"
},
{
"refId": "D",
"scenarioId": "random_walk"
},
{
"refId": "E",
"scenarioId": "random_walk"
},
{
"refId": "F",
"scenarioId": "random_walk"
},
{
"refId": "G",
"scenarioId": "random_walk"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Panel Title",
"type": "stat"
},
{
"datasource": null,
"gridPos": {
"h": 20,
"w": 4,
"x": 20,
"y": 0
},
"id": 8,
"interval": "10m",
"options": {
"colorMode": 0,
"displayMode": 2,
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
"mappings": [],
"max": 100,
"min": 0,
"thresholds": [
{
"color": "blue",
"value": null
},
{
"color": "green",
"value": 10
},
{
"color": "purple",
"value": 20
},
{
"color": "orange",
"value": 40
},
{
"color": "red",
"value": 80
}
],
"unit": "percent"
},
"override": {},
"values": false
},
"orientation": "auto",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.5.0-pre",
"targets": [
{
"refId": "A",
"scenarioId": "random_walk"
},
{
"refId": "B",
"scenarioId": "random_walk"
},
{
"refId": "C",
"scenarioId": "random_walk"
},
{
"refId": "D",
"scenarioId": "random_walk"
},
{
"refId": "E",
"scenarioId": "random_walk"
},
{
"refId": "F",
"scenarioId": "random_walk"
},
{
"refId": "G",
"scenarioId": "random_walk"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Panel Title",
"type": "stat"
},
{
"datasource": null,
"gridPos": {
"h": 3,
"w": 20,
"x": 0,
"y": 7
},
"id": 6,
"interval": "10m",
"options": {
"colorMode": 0,
"displayMode": 2,
"colorMode": "background",
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
@@ -237,60 +62,64 @@
"override": {},
"values": false
},
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.5.0-pre",
"pluginVersion": "6.6.0-pre",
"targets": [
{
"alias": "A longer title",
"refId": "A",
"scenarioId": "random_walk"
},
{
"refId": "B",
"scenarioId": "random_walk"
},
{
"alias": "AB",
"refId": "C",
"scenarioId": "random_walk"
},
{
"alias": "CPU",
"refId": "D",
"scenarioId": "random_walk"
},
{
"alias": "Google",
"labels": "",
"refId": "E",
"scenarioId": "random_walk"
},
{
"alias": "Even longer road title",
"refId": "F",
"scenarioId": "random_walk"
},
{
"alias": "Why does it have to",
"refId": "G",
"scenarioId": "random_walk"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Panel Title",
"title": "",
"type": "stat"
},
{
"datasource": null,
"gridPos": {
"h": 6,
"w": 20,
"h": 5,
"w": 24,
"x": 0,
"y": 10
"y": 2
},
"id": 3,
"id": 10,
"interval": "10m",
"options": {
"colorMode": 0,
"displayMode": 3,
"colorMode": "background",
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
@@ -319,43 +148,48 @@
"value": 80
}
],
"unit": "percent"
"unit": "areaM2"
},
"override": {},
"values": false
},
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.5.0-pre",
"pluginVersion": "6.6.0-pre",
"targets": [
{
"alias": "AB",
"refId": "A",
"scenarioId": "random_walk"
},
{
"refId": "B",
"scenarioId": "random_walk"
},
{
"alias": "CPU",
"labels": "",
"refId": "C",
"scenarioId": "random_walk"
},
{
"alias": "Longer title",
"refId": "D",
"scenarioId": "random_walk"
},
{
"alias": "Even longer title",
"refId": "E",
"scenarioId": "random_walk"
},
{
"alias": "Outside",
"refId": "F",
"scenarioId": "random_walk"
},
{
"alias": "Inside",
"refId": "G",
"scenarioId": "random_walk"
}
@@ -368,16 +202,15 @@
{
"datasource": null,
"gridPos": {
"h": 6,
"w": 20,
"h": 5,
"w": 24,
"x": 0,
"y": 16
"y": 7
},
"id": 4,
"id": 11,
"interval": "10m",
"options": {
"colorMode": 0,
"displayMode": 0,
"colorMode": "value",
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
@@ -411,12 +244,99 @@
"override": {},
"values": false
},
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.5.0-pre",
"pluginVersion": "6.6.0-pre",
"targets": [
{
"refId": "A",
"scenarioId": "random_walk"
},
{
"refId": "C",
"scenarioId": "random_walk"
},
{
"refId": "D",
"scenarioId": "random_walk"
},
{
"refId": "E",
"scenarioId": "random_walk"
},
{
"refId": "F",
"scenarioId": "random_walk"
},
{
"refId": "G",
"scenarioId": "random_walk"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Panel Title",
"transparent": true,
"type": "stat"
},
{
"datasource": null,
"gridPos": {
"h": 14,
"w": 6,
"x": 0,
"y": 12
},
"id": 13,
"interval": "10m",
"options": {
"colorMode": "background",
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
"mappings": [],
"max": 100,
"min": 0,
"thresholds": [
{
"color": "blue",
"value": null
},
{
"color": "green",
"value": 10
},
{
"color": "purple",
"value": 20
},
{
"color": "orange",
"value": 40
},
{
"color": "red",
"value": 80
}
],
"unit": "percent"
},
"override": {},
"values": false
},
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.6.0-pre",
"targets": [
{
"refId": "A",
@@ -455,16 +375,15 @@
{
"datasource": null,
"gridPos": {
"h": 21,
"h": 11,
"w": 4,
"x": 20,
"y": 20
"x": 6,
"y": 12
},
"id": 9,
"id": 8,
"interval": "10m",
"options": {
"colorMode": 0,
"displayMode": 0,
"colorMode": "background",
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
@@ -498,12 +417,14 @@
"override": {},
"values": false
},
"graphMode": "line",
"justifyMode": "auto",
"orientation": "auto",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.5.0-pre",
"pluginVersion": "6.6.0-pre",
"targets": [
{
"refId": "A",
@@ -542,16 +463,15 @@
{
"datasource": null,
"gridPos": {
"h": 6,
"w": 20,
"x": 0,
"y": 22
"h": 9,
"w": 8,
"x": 10,
"y": 12
},
"id": 5,
"id": 12,
"interval": "10m",
"options": {
"colorMode": 0,
"displayMode": 1,
"colorMode": "background",
"fieldOptions": {
"calcs": ["mean"],
"defaults": {
@@ -585,12 +505,14 @@
"override": {},
"values": false
},
"orientation": "auto",
"graphMode": "line",
"justifyMode": "auto",
"orientation": "horizontal",
"sparkline": {
"show": true
}
},
"pluginVersion": "6.5.0-pre",
"pluginVersion": "6.6.0-pre",
"targets": [
{
"refId": "A",
@@ -627,7 +549,7 @@
"type": "stat"
}
],
"schemaVersion": 20,
"schemaVersion": 21,
"style": "dark",
"tags": ["gdev", "panel-tests"],
"templating": {
@@ -643,5 +565,5 @@
"timezone": "",
"title": "Panel Tests - Stat",
"uid": "jWWHNJpWz",
"version": 6
"version": 25
}