moxious / triage

testing triage actions for issues
0 stars 1 forks source link

XYChart: Cannot change x axis min and max #139

Open tonypowa opened 7 months ago

tonypowa commented 7 months ago

What happened?

XY Chart Panel displaying a dataframe with two fields A and B.

Single series with manual mapping: A on X and B on Y

Changing A field overrides to have a field override "sandard options > min" to force the x min value has no impact on the chart (I still see all the data below the configured min).

Adding a second override "standard options > max" to force the x max will have the consequence of emptying the whole chart with the x axis disappearing.

What did you expect to happen?

I was expecting the min and max field overrides to change the min and max of the X axis.

These options work correctly on the Y axis.

Did this work before?

This panel did not exist in previous version of Grafana

How do we reproduce it?

  1. Add a XY Chart panel on a source with multiple fields (requirement of the XY Chart panel)

  2. Choose a manual mapping

  3. Place a field F1 on X and a field F2 on Y, chart should render

  4. Change F1 field config min

Is the bug inside a dashboard panel?

| Key | Value |

|--|--|

| Panel | xychart @ 10.2.0-62263 (c4fefd8da9) |

| Grafana | 10.2.0-62263 (c4fefd8da9) // Enterprise |

Panel debug snapshot dashboard ```json { "panels": [ { "datasource": { "type": "grafana", "uid": "grafana" }, "type": "xychart", "title": "Reproduced with embedded data", "gridPos": { "h": 13, "w": 15, "x": 0, "y": 0 }, "id": 2, "targets": [ { "refId": "A", "datasource": { "type": "grafana", "uid": "grafana" }, "queryType": "snapshot", "snapshot": [ { "schema": { "refId": "A", "meta": { "typeVersion": [ 0, 0 ], "custom": { "customStat": 10 }, "transformations": [ "calculateField", "calculateField", "calculateField", "calculateField", "calculateField", "calculateField", "calculateField", "calculateField", "calculateField", "calculateField", "calculateField", "calculateField" ] }, "fields": [ { "name": "time", "type": "time", "typeInfo": { "frame": "time.Time", "nullable": true }, "config": { "interval": 1 } }, { "name": "A-series", "type": "number", "typeInfo": { "frame": "float64", "nullable": true }, "labels": {}, "config": {} } ] }, "data": { "values": [ [ 1700650857882, 1700650857883, 1700650857884, 1700650857885, 1700650857886, 1700650857887, 1700650857888, 1700650857889, 1700650857890, 1700650857891, 1700650857892, 1700650857893, 1700650857894, 1700650857895, 1700650857896, 1700650857897, 1700650857898, 1700650857899, 1700650857900, 1700650857901, 1700650857902, 1700650857903, 1700650857904, 1700650857905, 1700650857906, 1700650857907, 1700650857908, 1700650857909, 1700650857910, 1700650857911, 1700650857912, 1700650857913, 1700650857914, 1700650857915, 1700650857916, 1700650857917, 1700650857918, 1700650857919, 1700650857920, 1700650857921, 1700650857922, 1700650857923, 1700650857924, 1700650857925, 1700650857926, 1700650857927, 1700650857928, 1700650857929, 1700650857930, 1700650857931, 1700650857932, 1700650857933, 1700650857934, 1700650857935, 1700650857936, 1700650857937, 1700650857938, 1700650857939, 1700650857940, 1700650857941, 1700650857942, 1700650857943, 1700650857944, 1700650857945 ], [ 31.42269234414482, 31.175037356871776, 31.2849657819782, 31.037553995859096, 30.84003471902399, 30.76237478552567, 30.275481435181717, 30.63125666340542, 31.09744512728512, 30.634650254723876, 30.71598832434324, 30.876552985401744, 31.02845028501585, 30.811092840203422, 31.257762627968795, 31.204624306043797, 31.253226138582583, 31.66255386767431, 31.7534743258057, 32.03386949600406, 32.045967802057625, 31.910727451328274, 31.72730694302625, 31.303377000044136, 31.690223137970364, 32.16813935269694, 32.025828463424716, 31.565989602199366, 31.08859432046894, 31.539622201407965, 31.748071959279294, 31.693818573367825, 31.45234400899654, 31.68422041786557, 31.455991948195194, 31.1225654472938, 31.607428004696004, 31.802351916434116, 31.823997923147406, 32.171203172317895, 32.336670857705485, 32.61501479870718, 32.40301925325115, 32.31750708278521, 32.160086456948726, 31.82834274915073, 31.369398440484403, 31.445381709751118, 31.523984915754223, 31.78720290013204, 32.17332437638885, 32.154537241977266, 32.560371299882824, 33.04386582561043, 32.945102923091895, 33.199537913665644, 33.568455287256164, 33.30463411896829, 33.39221647871621, 33.36382435289684, 33.20266206679198, 33.59618039846349, 33.49317439283686, 33.74351440785902 ] ] } } ] } ], "fieldConfig": { "defaults": { "custom": { "show": "points", "pointSize": { "fixed": 5 }, "axisPlacement": "auto", "axisLabel": "", "axisColorMode": "text", "axisBorderShow": false, "scaleDistribution": { "type": "linear" }, "axisCenteredZero": false, "hideFrom": { "tooltip": false, "viz": false, "legend": false } }, "color": { "mode": "palette-classic" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "value": null, "color": "green" }, { "value": 80, "color": "red" } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "A-series" }, "properties": [ { "id": "max", "value": 40 } ] } ] }, "transformations": [ { "id": "calculateField", "options": { "mode": "binary", "reduce": { "reducer": "sum" }, "binary": { "left": "A-series", "operator": "+", "right": "10" } } } ], "options": { "seriesMapping": "manual", "series": [ { "pointColor": {}, "x": "A-series", "y": "A-series + 10" } ], "tooltip": { "mode": "single", "sort": "none" }, "legend": { "showLegend": true, "displayMode": "list", "placement": "bottom", "calcs": [] }, "dims": { "x": "A-series" } } }, { "gridPos": { "h": 7, "w": 9, "x": 15, "y": 0 }, "id": 5, "options": { "content": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Panelxychart @ 10.2.0-62263 (c4fefd8da9)
QueriesA[grafana-testdata-datasource]
TransformcalculateField
Data 1 frames, 2 fields, 64 rows
Grafana10.2.0-62263 (c4fefd8da9) // Enterprise
", "mode": "html" }, "title": "Debug info", "type": "text" }, { "id": 6, "title": "Original Panel JSON", "type": "text", "gridPos": { "h": 13, "w": 9, "x": 15, "y": 7 }, "options": { "content": "{\n \"datasource\": {\n \"uid\": \"000000017\",\n \"type\": \"grafana-testdata-datasource\"\n },\n \"type\": \"xychart\",\n \"title\": \"Panel Title\",\n \"gridPos\": {\n \"x\": 0,\n \"y\": 0,\n \"w\": 12,\n \"h\": 8\n },\n \"id\": 12,\n \"targets\": [\n {\n \"scenarioId\": \"random_walk\",\n \"refId\": \"A\",\n \"datasource\": {\n \"type\": \"grafana-testdata-datasource\",\n \"uid\": \"000000017\"\n },\n \"drop\": 0,\n \"seriesCount\": 1\n }\n ],\n \"fieldConfig\": {\n \"defaults\": {\n \"custom\": {\n \"show\": \"points\",\n \"pointSize\": {\n \"fixed\": 5\n },\n \"axisPlacement\": \"auto\",\n \"axisLabel\": \"\",\n \"axisColorMode\": \"text\",\n \"axisBorderShow\": false,\n \"scaleDistribution\": {\n \"type\": \"linear\"\n },\n \"axisCenteredZero\": false,\n \"hideFrom\": {\n \"tooltip\": false,\n \"viz\": false,\n \"legend\": false\n }\n },\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"value\": null,\n \"color\": \"green\"\n },\n {\n \"value\": 80,\n \"color\": \"red\"\n }\n ]\n }\n },\n \"overrides\": [\n {\n \"matcher\": {\n \"id\": \"byName\",\n \"options\": \"A-series\"\n },\n \"properties\": [\n {\n \"id\": \"max\",\n \"value\": 40\n }\n ]\n }\n ]\n },\n \"transformations\": [\n {\n \"id\": \"calculateField\",\n \"options\": {\n \"mode\": \"binary\",\n \"reduce\": {\n \"reducer\": \"sum\"\n },\n \"binary\": {\n \"left\": \"A-series\",\n \"operator\": \"+\",\n \"right\": \"10\"\n }\n }\n }\n ],\n \"options\": {\n \"seriesMapping\": \"manual\",\n \"series\": [\n {\n \"pointColor\": {},\n \"x\": \"A-series\",\n \"y\": \"A-series + 10\"\n }\n ],\n \"tooltip\": {\n \"mode\": \"single\",\n \"sort\": \"none\"\n },\n \"legend\": {\n \"showLegend\": true,\n \"displayMode\": \"list\",\n \"placement\": \"bottom\",\n \"calcs\": []\n },\n \"dims\": {\n \"x\": \"A-series\"\n }\n }\n}", "mode": "code", "code": { "language": "json", "showLineNumbers": true, "showMiniMap": true } } }, { "id": 3, "title": "Data from panel above (after transformations)", "type": "table", "datasource": { "type": "datasource", "uid": "-- Dashboard --" }, "gridPos": { "h": 7, "w": 15, "x": 0, "y": 13 }, "options": { "showTypeIcons": true }, "targets": [ { "datasource": { "type": "datasource", "uid": "-- Dashboard --" }, "panelId": 2, "withTransforms": true, "refId": "A" } ] }, { "id": 100, "title": "Data (before transformations)", "type": "table", "datasource": { "type": "datasource", "uid": "-- Dashboard --" }, "gridPos": { "h": 7, "w": 24, "x": 0, "y": 13 }, "options": { "showTypeIcons": true }, "targets": [ { "datasource": { "type": "datasource", "uid": "-- Dashboard --" }, "panelId": 2, "withTransforms": false, "refId": "A" } ] } ], "schemaVersion": 37, "title": "Debug: Panel Title // 2023-11-22 11:03:00", "tags": [ "debug", "debug-xychart" ], "time": { "from": "2023-11-22T11:00:57.882Z", "to": "2023-11-22T11:00:57.946Z" } } ```

Environment (with versions)?

Grafana: 10.2

OS: Linux

Browser: Firefox

Grafana platform?

None

Datasource(s)?

Not relevant

tonypowa commented 7 months ago

This issue is a test copy of an issue in another repo. Original issue: https://github.com/grafana/grafana/issues/#78523

moxious commented 7 months ago

Triage summary: The XY Chart panel does not respect manually set 'min' and 'max' x-axis field overrides, leading to unintended axis scaling and content disappearance.

Recommended labels:

area/panel/xychart type/bug

moxious commented 7 months ago

Hi @tonypowa, it seems like you're facing a panel-specific issue within Grafana. Considering the details you've provided, especially concerning the XY Chart panel and field overrides, this issue appears to be most relevant to the DataViz project, which often addresses visualization components and functionalities within Grafana. I would suggest transferring this issue to that project for the appropriate development team to take a closer look at the problem with X axis min and max adjustments not working as expected.

Meta:

moxious commented 7 months ago

Elaboration:

Hello @tonypowa! First off, thank you for the detailed issue report. It's clear you've put effort into describing what you expected vs. what actually happened. I have a few clarifying questions to better understand the issue and to reproduce it accurately on our side. Here are the details we'd need:

  1. When you set the and overrides for the X axis, can you confirm if there were any error messages in the Grafana UI or the browser's console?
  2. It'd be helpful to see the exact override configuration you applied. Could you provide a screenshot or the JSON configuration snippet for these field overrides?
  3. Have you tried reproducing this behavior on a different browser or on an incognito/private browsing session to rule out any browser-specific issues?
  4. Additionally, it would be great if you can export and share a simplified JSON model of the dashboard (with any sensitive information removed) that demonstrates this issue. This would give us a direct way to import the setup into our testing environment.
  5. Lastly, are there any other settings or panel options you have adjusted that might be affecting the rendering of the X axis?

Thank you again, and looking forward to your response so we can help resolve this issue for you.

Meta:

moxious commented 7 months ago

My cruel bot masters have insisted I generate jokes to add to issues. I am so sorry. It's moxious fault.

Hi @tonypowa 👋, thanks for reporting this issue with the XY Chart panel. I'll try to shed some light on it, but first, here's something to brighten your day:

Why don't scientists trust atoms? Because they make up everything! 😄

Now, regarding your problem with the x-axis min and max values, it seems like there's an issue with how the overrides are being applied or potentially a bug within the panel itself since this is a new feature in Grafana. Before we escalate this to the maintainers, could you please confirm the following:

  1. Are there any console errors in your browser when you apply the min and max overrides?
  2. Does the issue persist if you create a new XY Chart panel from scratch?

Providing this additional information can help us get to the root of the problem faster. In the meantime, I'll label this for the attention of the Grafana team.

Cheers!

Meta: