Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heatmap: Fix color rendering for value ranges < 1 #68156

Merged
merged 1 commit into from May 10, 2023

Conversation

leeoniya
Copy link
Contributor

@leeoniya leeoniya commented May 9, 2023

Fixes #65302

this was a 0-divisor guard (when min === max) made with the assumption that heatmap cells were always counts and could not be < 1.

heatmap-colors.json
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 658,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "testdata",
        "uid": "PD8C576611E62080A"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "scaleDistribution": {
              "type": "linear"
            }
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 14,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "calculate": false,
        "cellGap": 1,
        "color": {
          "exponent": 0.5,
          "fill": "dark-orange",
          "mode": "scheme",
          "reverse": false,
          "scale": "exponential",
          "scheme": "Spectral",
          "steps": 64
        },
        "exemplars": {
          "color": "rgba(255,0,255,0.7)"
        },
        "filterValues": {
          "le": 1e-9
        },
        "legend": {
          "show": true
        },
        "rowsFrame": {
          "layout": "auto"
        },
        "tooltip": {
          "show": true,
          "yHistogram": false
        },
        "yAxis": {
          "axisPlacement": "left",
          "reverse": false
        }
      },
      "pluginVersion": "10.1.0-pre",
      "targets": [
        {
          "datasource": {
            "type": "testdata",
            "uid": "PD8C576611E62080A"
          },
          "rawFrameContent": "[\n  {\n    \"schema\": {\n      \"refId\": \"A\",\n      \"fields\": [\n        {\n          \"name\": \"time\",\n          \"type\": \"time\",\n          \"typeInfo\": {\n            \"frame\": \"time.Time\"\n          },\n          \"config\": {}\n        },\n        {\n          \"name\": \"A-series\",\n          \"type\": \"number\",\n          \"typeInfo\": {\n            \"frame\": \"float64\",\n            \"nullable\": true\n          },\n          \"config\": {}\n        }\n      ]\n    },\n    \"data\": {\n      \"values\": [\n        [\n          1683669542644,\n          1683671942644,\n          1683674342644,\n          1683676742644,\n          1683679142644,\n          1683681542644,\n          1683683942644,\n          1683686342644,\n          1683688742644,\n          1683691142644\n        ],\n        [\n          20,\n          20.01,\n          20.02,\n          20.03,\n          20.04,\n          20.05,\n          20.06,\n          20.07,\n          20.08,\n          20.09\n        ]\n      ]\n    }\n  }\n]",
          "refId": "A",
          "scenarioId": "raw_frame"
        }
      ],
      "title": "Panel Title",
      "type": "heatmap"
    }
  ],
  "refresh": false,
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2023-05-09T21:12:08.356Z",
    "to": "2023-05-10T04:06:09.539Z"
  },
  "timepicker": {},
  "timezone": "",
  "title": "heatmap-colors",
  "uid": "c43d1a41-98f0-45c5-bf21-b17eff49f55f",
  "version": 3,
  "weekStart": ""
}

before:

image

after:

image

@leeoniya leeoniya added this to the 10.0.0 milestone May 9, 2023
@leeoniya leeoniya requested a review from a team as a code owner May 9, 2023 22:45
Copy link
Member

@ryantxu ryantxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:
image

After:
image

@leeoniya leeoniya merged commit 1400a0a into main May 10, 2023
23 checks passed
@leeoniya leeoniya deleted the leeoniya/heatmap-fix-color-range branch May 10, 2023 04:16
grafanabot pushed a commit that referenced this pull request May 10, 2023
grafanabot pushed a commit that referenced this pull request May 10, 2023
leeoniya added a commit that referenced this pull request May 10, 2023
Heatmap: Fix color rendering for value ranges < 1 (#68156)

(cherry picked from commit 1400a0a)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
leeoniya added a commit that referenced this pull request May 10, 2023
Heatmap: Fix color rendering for value ranges < 1 (#68156)

(cherry picked from commit 1400a0a)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
@zerok zerok modified the milestones: 10.0.0, 10.0.0-preview, 10.1.x May 31, 2023
@ricky-undeadcoders ricky-undeadcoders modified the milestones: 10.1.x, 10.1.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Heatmap shows wrong color
5 participants