Stacked Bar Chart from Table Values

I have some MS SQL data that looks like this (after aggregations):

time       metric Revenue    Cost       Profit
1569909600 Sub1   177.345600 159.611040 17.734560
1569909600 Sub2   187.166900 168.450210 18.716690
1569909600 Sub3   209.718500 188.746650 20.971850

and I’m trying to get a stacked bar chart that looks similar to this:

chart001

I’m having a hell of a time figuring out any way to do it. Any chance someone could help me out? So far the best I can get is all of the bars lined up next to each other:

Ah, it looks like I just can’t stack series data. Found the popular 3-year-old github issue:

I agree with the commentators there that this seems like a no-brainer feature to implement (stacking series data by metric) and am quite surprised no support has been added for it in the 3 years since that issue was opened.

Looks like this plugin might work for me:

1 Like

Hi jceddy, I am trying to run a query for this visualization(grouped bar chart) but some how it is now processing all the values. Eg My query o/p on work bench is fine but I am getting lesser data on grafana. I am attaching my code and o/p screenshots. Please guide me.
Thanks in advance.

1 Like

Hey,

I’m using Grafana 8.2.5, have installed this plugin in my Grafana’s plugin directory after that I have restarted the Grafana Server but still plugin is not visible on console.

Please help me out.

Thanks in advance

With Grafana 8.0 and up, I do not think you need the plug-in. You should be able to do this without any plugins.

Is it possible by writing a SQL queries like grouping, joining etc?

Because I’am doing by creating a SQL queries. It’s not giving the desired stacked bar chart.

It should be. We use MSSQL queries to make the Pie charts, and the logic to make Bar charts should be the same.

Can you post your query text here and the results you get (in SSMS and Grafana)?

Could you share the method you applied to make this chart?
thank you :pray:
I stuck in this problem with the stacked look for so long…

Hi, Am looking to create a stacked horizontal bar chart for non-time series data in grafana Similar to below


Not sure what are the options in grafana ? Any help is apprecaited.

Hi, Even Am looking to create a stacked horizontal bar chart for non-time series data in grafana Similar to below


Not sure what are the options in grafana ? Any help is apprecaited.
Where you able to find the solution ?