Stacking Values on bar chart with grafana

Hello I need some help.

I have 2 mysql tables with the values

first table:

"time","value"
"2023-01-28 01:00:03.520","741"
"2023-01-28 14:14:30.520","509"
"2023-01-28 14:16:07.238","584"
"2023-01-28 14:17:49.630","562"
"2023-01-28 14:19:28.024","572"
"2023-01-28 14:21:10.336","569"
"2023-01-28 14:22:52.757","577"
"2023-01-28 14:24:29.733","583"
"2023-01-28 14:26:12.163","581"
"2023-01-28 14:27:50.475","576"
"2023-01-28 14:29:32.869","578"
"2023-01-28 14:31:15.612","580"
"2023-01-28 14:34:35.110","588"
"2023-01-28 14:36:16.407","598"
"2023-01-28 14:37:58.818","613"
"2023-01-28 14:39:35.873","642"
"2023-01-28 14:43:01.070","653"
"2023-01-28 14:46:21.825","662"
"2023-01-28 14:47:58.777","663"
"2023-01-28 14:49:41.514","664"
"2023-01-28 14:51:23.907","666"
"2023-01-28 14:53:00.869","667"
"2023-01-28 14:54:46.089","663"
"2023-01-28 14:56:23.192","660"
"2023-01-28 14:58:05.724","657"
"2023-01-28 14:59:42.655","652"
"2023-01-28 15:01:25.240","650"
"2023-01-28 15:03:07.829","647"
"2023-01-28 15:04:47.386","648"
"2023-01-28 15:06:29.820","641"
"2023-01-28 15:08:06.676","637"
"2023-01-28 15:09:49.169","634"
"2023-01-28 15:11:31.687","635"
"2023-01-28 15:13:10.290","632"
"2023-01-28 15:14:52.725","627"
"2023-01-28 15:16:29.588","623"
"2023-01-28 15:18:12.090","619"
"2023-01-28 15:19:55.673","615"
"2023-01-28 15:21:32.623","608"
"2023-01-28 15:23:15.275","600"
"2023-01-28 15:26:34.683","601"
"2023-01-28 15:28:16.464","602"
"2023-01-29 01:12:11.935","594"
"2023-01-29 01:13:54.662","587"
"2023-01-29 01:15:31.609","586"
"2023-01-29 01:17:13.403","584"
"2023-01-29 01:18:55.981","579"
"2023-01-29 01:20:33.006","576"
"2023-01-29 01:22:15.999","574"
"2023-01-29 01:23:58.492","569"
"2023-01-29 01:25:35.405","563"
"2023-01-29 01:27:20.085","559"
"2023-01-29 01:28:57.060","557"
"2023-01-29 01:30:39.856","555"
"2023-01-29 01:32:22.372","554"
"2023-01-29 01:33:59.309","553"
"2023-01-29 01:35:41.897","551"
"2023-01-29 01:39:05.514","550"
"2023-01-29 01:39:43.782","550"
"2023-01-29 01:39:46.539","550"
"2023-01-29 01:40:42.594","552"
"2023-01-29 01:42:25.128","551"
"2023-01-29 01:44:07.691","550"
"2023-01-29 01:45:45.151","547"
"2023-01-29 01:49:10.730","546"
"2023-01-29 01:50:47.594","542"
"2023-01-29 01:52:30.111","543"
"2023-01-29 01:54:12.623","539"
"2023-01-29 01:55:51.006","541"

and second table:

"2023-01-28 23:09:42.060","482"
"2023-01-28 23:11:18.967","483"
"2023-01-28 23:13:01.508","479"
"2023-01-28 23:16:22.574","477"
"2023-01-28 23:18:05.079","481"
"2023-01-28 23:19:42.000","484"
"2023-01-28 23:21:24.569","483"
"2023-01-28 23:24:47.021","484"
"2023-01-28 23:26:29.733","482"
"2023-01-28 23:28:06.736","481"
"2023-01-28 23:29:49.265","482"
"2023-01-28 23:31:30.140","481"
"2023-01-28 23:33:12.784","482"
"2023-01-28 23:34:50.132","478"
"2023-01-28 23:36:32.629","480"
"2023-01-28 23:38:15.159","482"
"2023-01-28 23:39:52.100","483"
"2023-01-28 23:41:31.901","481"
"2023-01-28 23:43:14.666","483"
"2023-01-28 23:46:34.114","480"
"2023-01-28 23:48:16.679","478"
"2023-01-28 23:49:56.917","474"
"2023-01-28 23:51:39.517","472"
"2023-01-28 23:53:16.607","470"
"2023-01-28 23:56:41.724","472"
"2023-01-29 00:00:03.281","471"
"2023-01-29 00:01:40.634","469"
"2023-01-29 00:03:22.603","466"
"2023-01-29 00:05:05.101","465"
"2023-01-29 00:06:42.030","468"
"2023-01-29 00:08:27.251","469"
"2023-01-29 00:11:46.845","483"
"2023-01-29 00:13:29.397","494"
"2023-01-29 00:15:06.336","502"
"2023-01-29 00:16:50.238","510"
"2023-01-29 00:18:27.228","522"
"2023-01-29 00:20:09.929","533"
"2023-01-29 00:21:46.876","535"
"2023-01-29 00:23:31.809","539"
"2023-01-29 00:25:14.562","547"
"2023-01-29 00:26:53.019","552"
"2023-01-29 00:28:35.988","556"
"2023-01-29 00:30:12.873","570"
"2023-01-29 00:31:55.403","580"
"2023-01-29 00:33:37.960","589"
"2023-01-29 00:35:14.391","591"

I want to display them in a horizontal bar chart seperated by the day and stack the two tables on the bar in different colors.

How can I do this?

this is how I create a bar graph how can I stack now another table on it in different color?

SELECT
  $__timeGroup(time, '24h') as time,
  value as metric
FROM
  table1
WHERE
  $__timeFilter(time)
GROUP BY
  $__timeGroup(time, '24h'),
  value
ORDER BY 1

The Tutorials and Solutions category is where one posts a tutorial or solution, not a place to ask for one.

You do not mention what you are using to generate the chart. Grafana? MainUI? Sitemaps? HABPanel?

I am using grafana

Put that in your title and tags.

While we have a lot of Grafana users here and you might get an answer, you will more likely get an answer on a Grafana forum.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.