Unable to visualize bar chart with using datasource as MS SQL

  • What Grafana version and what operating system are you using?
    • Version 2.0.8.2
  • What are you trying to achieve?
    • Visualize a bar chart by X-axis represents datetime and Y-axis represents value.
  • How are you trying to achieve it?
    • Setup datasource as MS SQL and put the SQL command as below.

      SELECT
      FORMAT(CONVERT(DATETIME, [Datetime]), ‘yyyy-MM-dd’) AS [Date],
      AVG(CASE
      WHEN TRY_CONVERT(FLOAT, [ACP_PTHP_01_PV]) < 0 THEN 0.0
      ELSE TRY_CONVERT(FLOAT, [ACP_PTHP_01_PV])
      END) AS AVG_ACP_PTHP_01_PV
      FROM
      [TBC].[dbo].[acs_data]

GROUP BY
FORMAT(CONVERT(DATETIME, [Datetime]), ‘yyyy-MM-dd’)
ORDER BY
[Date];

It’s working well in MS SQL Studio with showing the correct output but once need to visualize a bar chart it has nothing to show just only X-axis shows datetime and Y-axis shows number data correctly. In addtions, once move a mouse hover on a graph there always show “Invalid Date”.

  • What happened?
    No any bar chart appear on a graph and when using mouse hovering on graph then will see “Invalide Date” message even inspect at Query Inspector the data already shows for example.
    0:Array[2023-10-18,2.2506510416666847]

1:Array[2023-10-19,2.0337395833333547]

2:Array[2023-10-20,2.067236151603489]

3:Array[2023-10-21,2.09506611078015]

4:Array[2023-10-22,2.2499201388888883]

5:Array[2023-10-23,2.214543402777795]

6:Array[2023-10-24,2.282494155844177]

7:Array[2023-10-25,2.183381670533614]

8:Array[2023-10-26,2.170195771792652]

9:Array[2023-10-27,2.088389101338378]

10:Array[2023-10-28,1.9896487268518093]

  • What did you expect to happen?
    I want the bar chart display on graph associated with the data that perform query.

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

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

  • Did you follow any online instructions? If so, what is the URL?