K-Phoen / grabana

User-friendly Go library for building Grafana dashboards
MIT License
680 stars 69 forks source link

Support for range mappings on stat panel #222

Open AndersSoee opened 1 year ago

AndersSoee commented 1 year ago

singlestat panel is deprecated, but the stat panel only supports a small portion of the features. One thing i am missing is support for mappings. This is the json from grafana, from such a mapping. How would you go about adding that? I guess it would also require changes in the sdk.

"type": "stat",
  "fieldConfig": {
    "defaults": {
      "mappings": [
        {
          "type": "range",
          "options": {
            "from": 0,
            "to": 0.9,
            "result": {
              "text": "DOWN"
            }
          }
        },
        {
          "type": "range",
          "options": {
            "from": 1,
            "to": 1,
            "result": {
              "text": "UP"
            }
          }
        },