-
What Grafana version and what operating system are you using?
Grafana Cloud ON Mac OS -
What are you trying to achieve?
I want to show bar values X pixels to the right of the stacked bar, rather than on top of it. -
How are you trying to achieve it?
I know this isn’t possible with the regular stacked bar functionality and was wondering if the best way to do this was via a custom plugin, or somehow editing the JSON of the dashboard? -
Can you copy/paste the configuration(s) that you are having problems with?
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "ceffjw790d24gc"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "dark-red"
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "NBA Volume"
},
"properties": [
{
"id": "custom.axisColorMode",
"value": "text"
},
{
"id": "color",
"value": {
"mode": "palette-classic"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "College Basketball Volume"
},
"properties": [
{
"id": "color",
"value": {
"mode": "palette-classic"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "MLB Volume"
},
"properties": [
{
"id": "color",
"value": {
"mode": "palette-classic"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "NHL Volume"
},
"properties": [
{
"id": "color",
"value": {
"mode": "palette-classic"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "__total_volume"
},
"properties": [
{
"id": "custom.hideFrom",
"value": {
"legend": false,
"tooltip": false,
"viz": true
}
}
]
},
{
"matcher": {
"id": "byName",
"options": ""
},
"properties": []
}
]
},
"gridPos": {
"h": 18,
"w": 12,
"x": 12,
"y": 0
},
"id": 10,
"options": {
"barRadius": 0,
"barWidth": 0.97,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"orientation": "auto",
"showValue": "always",
"stacking": "normal",
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"pluginVersion": "11.6.0-84846",
"targets": [
{
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "WITH date_series AS (\r\n SELECT generate_series(\r\n GREATEST(\r\n (SELECT MIN(DATE_TRUNC('day', settled_at)) FROM reporting_trades),\r\n to_timestamp($__from/1000)\r\n ),\r\n LEAST(CURRENT_DATE + 1, to_timestamp($__to/1000)), -- Added +1 to include current partial day\r\n '1 day'::interval\r\n )::date AS day\r\n),\r\nsettled_leagues AS (\r\n SELECT\r\n t.*,\r\n e.start_date,\r\n e.tournament_name,\r\n DATE_TRUNC('day', t.settled_at) AS settled_day\r\n FROM trades t\r\n JOIN events e ON t.event_id::VARCHAR = e.event_id\r\n WHERE t.settled_at IS NOT NULL\r\n AND t.settled_at >= to_timestamp($__from/1000)\r\n AND t.settled_at < to_timestamp($__to/1000)\r\n AND e.tournament_name IN ('NBA', 'College Basketball', 'MLB', 'NHL')\r\n)\r\nSELECT\r\n ds.day::timestamp AS time,\r\n -- TO_CHAR(day, 'MM/DD') || ' (g=' || __total_volume || ')' as date_and_games,\r\n COALESCE(SUM(CASE WHEN sl.tournament_name = 'NBA' THEN sl.stake ELSE 0 END) / 1000.0, 0) AS \"NBA Volume\",\r\n COALESCE(SUM(CASE WHEN sl.tournament_name = 'College Basketball' THEN sl.stake ELSE 0 END) / 1000.0, 0) AS \"College Basketball Volume\",\r\n COALESCE(SUM(CASE WHEN sl.tournament_name = 'MLB' THEN sl.stake ELSE 0 END) / 1000.0, 0) AS \"MLB Volume\",\r\n COALESCE(SUM(CASE WHEN sl.tournament_name = 'NHL' THEN sl.stake ELSE 0 END) / 1000.0, 0) AS \"NHL Volume\",\r\n COALESCE(SUM(sl.stake) / 1000.0, 0) AS \"__total_volume\"\r\nFROM\r\n date_series ds\r\nLEFT JOIN\r\n settled_leagues sl ON ds.day = DATE_TRUNC('day', sl.settled_day)\r\nGROUP BY\r\n ds.day\r\nORDER BY\r\n ds.day;",
"refId": "A",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"title": "Daily Stacked Volume",
"type": "barchart"
}