Stacking bar in barchart

Hello,

I’m pretty new to Grafana and Data Base manipulation. I’m trying to create a BarCharts which represent the amount of parts produced for each Parts Type. I need to stack the bar and I can’t find a solution to do it

  • What Grafana version and what operating system are you using?
    v9.4.10

  • What are you trying to achieve?
    Stack bar in a Bar Charts.

  • How are you trying to achieve it?
    That’s the question

  • What happened?
    Impossible to find a solution to stack bar. Here is my result for now :

  • What did you expect to happen?
    Exemple here made with Excel :

  • Can you copy/paste the configuration(s) that you are having problems with?

`DECLARE @start DATETIME
DECLARE @end DATETIME
DECLARE @offsetDay INT = 0

IF (SELECT DATEPART(weekday,GETDATE())) = 1
SET @offsetDay = -2

SET @start = (SELECT DATEADD(dd, @offsetDay, DATEDIFF(dd, 0, GETDATE())))
SET @start = (SELECT DATEADD(hh,-19, @start))

SET @end = (SELECT DATEADD(dd, @offsetDay, DATEDIFF(dd, 0, GETDATE())))
SET @end = (SELECT DATEADD(hh,5,@end))

SELECT
TypeID,
COUNT(*) as Real_Prod
FROM
L7DAE.dbo.OP7300
WHERE
LeaveDate BETWEEN @start AND @end
AND PartState = 1
GROUP BY
TypeId
ORDER BY MIN(LeaveDate) ASC `

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No
  • Did you follow any online instructions? If so, what is the URL?
    No

Thanks in advance for your help !