I have noticed a weird behavior of the time series panel.
I have a simple query, weekly time points with some numeric series, generated by a postgres query. When I create the Time Series panel it works perfectly, as expected:
I copied the query (to ensure the time points are the same), modified the metric values and renamed the metric1 to metric2. Once I run it, suddenly the bars become extremely thin and for some reason the last data point is colored wrong.
Anyone knows how to fix this?
Key | Value |
---|---|
Panel | timeseries @ 9.3.8 (7ab70dbce8) |
Grafana | 9.3.8 (7ab70dbce8) // Open Source |
Panel debug snapshot dashboard
{
"panels": [
{
"id": 2,
"gridPos": {
"h": 13,
"w": 15,
"x": 0,
"y": 0
},
"type": "timeseries",
"title": "Reproduced with embedded data",
"datasource": {
"type": "grafana",
"uid": "grafana"
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "bars",
"lineInterpolation": "linear",
"barAlignment": 0,
"lineWidth": 0,
"fillOpacity": 100,
"gradientMode": "none",
"spanNulls": false,
"showPoints": "auto",
"pointSize": 5,
"stacking": {
"mode": "normal",
"group": "A"
},
"axisPlacement": "auto",
"axisLabel": "",
"axisColorMode": "text",
"scaleDistribution": {
"type": "linear"
},
"axisCenteredZero": false,
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"thresholdsStyle": {
"mode": "off"
}
},
"color": {
"mode": "palette-classic"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"options": {
"tooltip": {
"mode": "single",
"sort": "none"
},
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom",
"calcs": []
}
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "grafana",
"uid": "grafana"
},
"queryType": "snapshot",
"snapshot": [
{
"schema": {
"refId": "A",
"meta": {
"executedQueryString": "SELECT * FROM (\r\n VALUES\r\n (1, '2023-04-23 00:00:00'::TIMESTAMP),\r\n (3, '2023-04-30 00:00:00'::TIMESTAMP),\r\n (10, '2023-05-07 00:00:00'::TIMESTAMP),\r\n (5, '2023-05-14 00:00:00'::TIMESTAMP)\r\n ) AS s(metric1, time)\r\n"
},
"fields": [
{
"name": "metric1",
"type": "number",
"typeInfo": {
"frame": "int32",
"nullable": true
},
"config": {}
},
{
"name": "time",
"type": "time",
"typeInfo": {
"frame": "time.Time",
"nullable": true
},
"config": {}
}
]
},
"data": {
"values": [
[
1,
3,
10,
5
],
[
1682208000000,
1682812800000,
1683417600000,
1684022400000
]
]
}
},
{
"schema": {
"refId": "B",
"meta": {
"executedQueryString": "SELECT * FROM (\r\n VALUES\r\n (5, '2023-04-23 00:00:00'::TIMESTAMP),\r\n (6, '2023-04-30 00:00:00'::TIMESTAMP),\r\n (0, '2023-05-07 00:00:00'::TIMESTAMP),\r\n (2, '2023-05-14 00:00:00'::TIMESTAMP)\r\n ) AS s(metric2, time)\r\n"
},
"fields": [
{
"name": "metric2",
"type": "number",
"typeInfo": {
"frame": "int32",
"nullable": true
},
"config": {}
},
{
"name": "time",
"type": "time",
"typeInfo": {
"frame": "time.Time",
"nullable": true
},
"config": {}
}
]
},
"data": {
"values": [
[
5,
6,
0,
2
],
[
1682208000000,
1682812800000,
1683417600000,
1684022400000
]
]
}
}
]
}
]
},
{
"gridPos": {
"h": 7,
"w": 9,
"x": 15,
"y": 0
},
"id": 5,
"options": {
"content": "<table width=\"100%\">\n <tr>\n <th width=\"2%\">Panel</th>\n <td >timeseries @ 9.3.8 (7ab70dbce8)</td>\n </tr>\n <tr>\n <th>Queries</th>\n <td>A[postgres], B[postgres]</td>\n </tr>\n \n <tr><th>Data</th><td> 2 frames, 4 fields, 8 rows </td></tr>\n \n <tr>\n <th>Grafana</th>\n <td>9.3.8 (7ab70dbce8) // Open Source</td>\n </tr>\n </table>",
"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 \"id\": 2,\n \"gridPos\": {\n \"h\": 16,\n \"w\": 24,\n \"x\": 0,\n \"y\": 0\n },\n \"type\": \"timeseries\",\n \"title\": \"Panel Title\",\n \"datasource\": {\n \"uid\": \"CNGEJGw7k\",\n \"type\": \"postgres\"\n },\n \"fieldConfig\": {\n \"defaults\": {\n \"custom\": {\n \"drawStyle\": \"bars\",\n \"lineInterpolation\": \"linear\",\n \"barAlignment\": 0,\n \"lineWidth\": 0,\n \"fillOpacity\": 100,\n \"gradientMode\": \"none\",\n \"spanNulls\": false,\n \"showPoints\": \"auto\",\n \"pointSize\": 5,\n \"stacking\": {\n \"mode\": \"normal\",\n \"group\": \"A\"\n },\n \"axisPlacement\": \"auto\",\n \"axisLabel\": \"\",\n \"axisColorMode\": \"text\",\n \"scaleDistribution\": {\n \"type\": \"linear\"\n },\n \"axisCenteredZero\": false,\n \"hideFrom\": {\n \"tooltip\": false,\n \"viz\": false,\n \"legend\": false\n },\n \"thresholdsStyle\": {\n \"mode\": \"off\"\n }\n },\n \"color\": {\n \"mode\": \"palette-classic\"\n },\n \"mappings\": [],\n \"thresholds\": {\n \"mode\": \"absolute\",\n \"steps\": [\n {\n \"color\": \"green\",\n \"value\": null\n },\n {\n \"color\": \"red\",\n \"value\": 80\n }\n ]\n }\n },\n \"overrides\": []\n },\n \"options\": {\n \"tooltip\": {\n \"mode\": \"single\",\n \"sort\": \"none\"\n },\n \"legend\": {\n \"showLegend\": true,\n \"displayMode\": \"list\",\n \"placement\": \"bottom\",\n \"calcs\": []\n }\n },\n \"targets\": [\n {\n \"datasource\": {\n \"type\": \"postgres\",\n \"uid\": \"CNGEJGw7k\"\n },\n \"editorMode\": \"code\",\n \"format\": \"table\",\n \"hide\": false,\n \"rawQuery\": true,\n \"rawSql\": \"SELECT * FROM (\\r\\n VALUES\\r\\n (1, '2023-04-23 00:00:00'::TIMESTAMP),\\r\\n (3, '2023-04-30 00:00:00'::TIMESTAMP),\\r\\n (10, '2023-05-07 00:00:00'::TIMESTAMP),\\r\\n (5, '2023-05-14 00:00:00'::TIMESTAMP)\\r\\n ) AS s(metric1, time)\\r\\n\",\n \"refId\": \"A\",\n \"sql\": {\n \"columns\": [\n {\n \"parameters\": [],\n \"type\": \"function\"\n }\n ],\n \"groupBy\": [\n {\n \"property\": {\n \"type\": \"string\"\n },\n \"type\": \"groupBy\"\n }\n ],\n \"limit\": 50\n }\n },\n {\n \"datasource\": {\n \"type\": \"postgres\",\n \"uid\": \"CNGEJGw7k\"\n },\n \"editorMode\": \"code\",\n \"format\": \"table\",\n \"hide\": false,\n \"rawQuery\": true,\n \"rawSql\": \"SELECT * FROM (\\r\\n VALUES\\r\\n (5, '2023-04-23 00:00:00'::TIMESTAMP),\\r\\n (6, '2023-04-30 00:00:00'::TIMESTAMP),\\r\\n (0, '2023-05-07 00:00:00'::TIMESTAMP),\\r\\n (2, '2023-05-14 00:00:00'::TIMESTAMP)\\r\\n ) AS s(metric2, time)\\r\\n\",\n \"refId\": \"B\",\n \"sql\": {\n \"columns\": [\n {\n \"parameters\": [],\n \"type\": \"function\"\n }\n ],\n \"groupBy\": [\n {\n \"property\": {\n \"type\": \"string\"\n },\n \"type\": \"groupBy\"\n }\n ],\n \"limit\": 50\n }\n }\n ]\n}",
"mode": "code",
"code": {
"language": "json",
"showLineNumbers": true,
"showMiniMap": true
}
}
},
{
"id": 3,
"title": "Data from panel above",
"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"
}
]
}
],
"schemaVersion": 37,
"title": "Debug: Panel Title // 2023-04-13 21:33:34",
"tags": [
"debug",
"debug-timeseries"
],
"time": {
"from": "2023-03-31T22:00:00.000Z",
"to": "2023-05-31T21:59:59.000Z"
}
}