Bar gauge not showing zero when there is no data

Hi All,

I am using Grafana 8.1.1 version in ubuntu 20.4LTs. I am using “Bar Gauge” panel to show statistics of two parameters. When there is data for both parameters, the graph is like this.

But there is data for one parameter graph shows it like this way.
Then we cannot recognize to which parameter the panel is showing.

This is my query scripts.

This is how I set the panel options.


Can anyone please help me to resolve this issue.

One solution would be to change your SQL queries so something is always returned. For example something like using a union (this may not work exactly in your case but something like this should):

select time, sum(value) as “OPD Visits”
(select now() as time, 0 as value
union all
(your select here but name your second field as “value”) as myunion

Therefore, if your select returns nothing you should still get a result of zero.

You have not said what your datasource is, in my version of MySQL you can do a “select” without a “from”, some other databases you can’t but there are probably ways to do the same thing.