Hello everyone,I am Using Grafana v8.2.0 .
I wanted to set the “symbol” to metric column, but that didn’t work.
Here is my panel:
Here is my panel data:
Here is my panel json:
{
"id": 23763571993,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 17
},
"type": "timeseries",
"title": "Panel Title",
"description": "",
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineInterpolation": "smooth",
"barAlignment": 0,
"lineWidth": 1,
"fillOpacity": 0,
"gradientMode": "none",
"spanNulls": true,
"showPoints": "auto",
"pointSize": 5,
"stacking": {
"mode": "normal",
"group": "A"
},
"axisPlacement": "auto",
"axisLabel": "",
"scaleDistribution": {
"type": "linear"
},
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"thresholdsStyle": {
"mode": "off"
},
"axisWidth": -1,
"lineStyle": {
"fill": "solid"
}
},
"color": {
"mode": "palette-classic"
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"mappings": []
},
"overrides": []
},
"options": {
"tooltip": {
"mode": "single"
},
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": []
}
},
"targets": [
{
"format": "table",
"group": [
{
"params": [
"$__interval",
"none"
],
"type": "time"
},
{
"params": [
"symbol"
],
"type": "column"
}
],
"metricColumn": "symbol",
"rawQuery": true,
"rawSql": "SELECT \r\n\torder_date,\r\n\tsymbol AS metric,\r\n\tSUM(profits) AS profits\r\nFROM (\r\n\tSELECT\r\n\t\tsymbol,\r\n\t\torder_date,\r\n\t\tSUM(profits) OVER (PARTITION BY symbol ORDER BY order_date) AS profits\r\n\tFROM (\r\n\t\t SELECT SUBSTRING_INDEX(symbol,\"_\",1) AS symbol,\r\n\t\t\t\t\t\tDATE(c_time) AS order_date,\r\n\t\t\t\t\t\tSUM(total_profits + fee) AS profits\r\n\t\t FROM ods_a_order\r\n\t\t WHERE $__timeFilter(c_time)\r\n\t\t GROUP BY SUBSTRING_INDEX(symbol,\"_\",1),DATE(c_time)\r\n\t)t1\r\n\tUNION ALL\r\n\tSELECT\r\n\t\tsymbol,\r\n\t\torder_date,\r\n\t\tSUM(profits) OVER (PARTITION BY symbol ORDER BY order_date) AS profits\r\n\tFROM (\r\n\t\t SELECT CONCAT(SUBSTRING_INDEX(inst_id,\"-\",1),\"\") AS symbol,\r\n\t\t\t\t\t\tDATE(c_time) AS order_date,\r\n\t\t\t\t\t\tSUM(pnl + fee) AS profits\r\n\t\t FROM ods_b_order\r\n\t\t WHERE $__timeFilter(c_time)\r\n\t\t GROUP BY CONCAT(SUBSTRING_INDEX(inst_id,\"-\",1),\"\"),DATE(c_time)\r\n\t)t2\r\n)t\r\nGROUP BY order_date,symbol;",
"refId": "A",
"select": [
[
{
"params": [
"total_profits"
],
"type": "column"
},
{
"params": [
"sum"
],
"type": "aggregate"
},
{
"params": [
"total_profits"
],
"type": "alias"
}
]
],
"table": "",
"timeColumn": "c_time",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"datasource": null
}