Skip to content

Commit

Permalink
Merge pull request grafana#44 from roidelapluie/color
Browse files Browse the repository at this point in the history
Enable Singlestat colors
  • Loading branch information
roidelapluie authored Nov 23, 2017
2 parents e0c665d + fb69502 commit 98285f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
20 changes: 12 additions & 8 deletions grafonnet/singlestat.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
valueName="avg",
valueFontSize="80%",
mappingType=1,
colors=[
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a",
],
colorBackground=false,
colorValue=false,
thresholds="",
valueMaps=[
{
value: "null",
Expand Down Expand Up @@ -70,14 +78,10 @@
prefixFontSize: "50%",
valueFontSize: valueFontSize,
postfixFontSize: "50%",
thresholds: "",
colorBackground: false,
colorValue: false,
colors: [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a",
],
thresholds: thresholds,
colorBackground: colorBackground,
colorValue: colorValue,
colors: colors,
sparkline: {
show: false,
full: false,
Expand Down
8 changes: 8 additions & 0 deletions tests/singlestat/test.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ local singlestat = grafana.singlestat;
valueName="current",
mappingType="range",
valueMaps=["foo"],
colors=[
"rgba(237, 129, 40, 0.89)",
"#d44a3a",
"#299c46",
],
colorBackground=true,
colorValue=true,
thresholds="1,2",
rangeMaps=["bar"],
),
value: singlestat.new(
Expand Down
10 changes: 5 additions & 5 deletions tests/singlestat/test_compiled.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"advanced": {
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colorBackground": true,
"colorValue": true,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
"#d44a3a",
"#299c46"
],
"datasource": "prom1",
"decimals": 2,
Expand Down Expand Up @@ -51,7 +51,7 @@
},
"tableColumn": "",
"targets": [ ],
"thresholds": "",
"thresholds": "1,2",
"title": "adv",
"transparent": true,
"type": "singlestat",
Expand Down

0 comments on commit 98285f9

Please sign in to comment.