Best way to report both negative and positive values

Is there a workaround to get a center zero gauge or histogram?

I want to monitor/report on Net Energy. If generation from solar panels exceeds consumption then we are exporting (-ve) otherwise we are importing (+ve).

I have seen other questions on centre zero guages but not found a way to to do it - how have others solved this problem?

1 Like

Welcome to the forum.

What is your datasource and which version of Grafana are you using?

Hello Grant, thanks for responding

Datasourse is influxDB v1.8 which receives data from my energy monitor (IoTaWatt)

Grafana version is 7.5.5

What I am aiming for is a dial that runs from (say) minus 10Kw to + 10kw with zero in the centre. The color (reading) should then from the centre towards the left if negative and from the centre towards the right if positive.

A histogram would work for this use case (instead of a dial) but if I set the histogram limits from -10 to +10 and have a reading of (say) 2 then the bar starts at -10 and runs to 2 instead of starting at zero and running to 2.

is there a way to say ‘start the bar at zero rather than the minimum’ for a histogram?

I think this works if you upgrade to Grafana 8.1:

In InfluxDB 2.0 Data Explorer:

Thanks for coming back so quickly, The Data Explorer view is close and might do the trick.

On your normal gauge the colour is starting at -15 (the gauge minimum) and not at zero.

Here are a couple of examples (I’ve edited your 6.73 gauge) to show what I am trying to achieve.

The bar also centres on zero and extends left and right from the zero (clumsy excel chart)

I’m hoping that there is a setting that I’ve missed…

1 Like

Hmmm…I cannot find a way in Grafana to change the bar as you indicated in your screenshot:
image

Maybe a future update of Grafana will address this? (any Grafana staff want to to chime in?)

I do not know if InfluxDB 1.8 offers any charting tools like 2.0 does, but give it a try, or post your question on the InfluxDB forum.

1 Like

Implemented it. See my pull request: Setting the neutral-point of a gauge by sfranzis · Pull Request #53989 · grafana/grafana · GitHub

1 Like

@sfranzis Thank you coming back to this thread to let us know.

Hopefully it will be merged and available to use soon.

Hi Stefan, how can I implement your workaround in Grafana?

Hi guys,

my implementation has been released with Grafana 9.3.0. See Gauge-Options, input “Neutral” Hope you like it :slight_smile:

Stefan

1 Like

Thanks for letting us know.

I couldn’t find the setting (9.3.1 running on Raspberry Pi) but when I put ‘neutral’ in the ‘Search options’ box I found it (not sure if I just missed it the first time). It is there in the main options now.

The documentation doesn’t appear to have been updated yet.

From playing with it:

  • Leaving it blank has the gauge as before.
  • Putting a number in has the ‘split’ point at the number
  • if you set min and max to the (signed) same amount e.g.min = -10, max = 10 and the ‘neutral’ is set to 0 then the threshold will be at the apex of the gauge.
1 Like

Thanks for your feedback. You can also set neutral to non-zero values.
Example use case: monitoring line frequency. Min:49.5, Max: 50.5, Neutral: 50.0

Hi Stefan,

thanks for your Gauge Neutral extension!

May you could help me with another problem :wink:

I’m trying to display the difference between two measurements - 1.7.0 (Wirk. P+) and 2.7.0 (Wirk. P-)

I do then a transformation (difference calculation):
In the table view I can see the calc result, but the gauge is always 0…

Do you have an idea why it is like that?

Thanks,
Andi

Hi Andi, I had a similar issue with another measurement and ended up implementing the difference in the data source (the application that collected the data)
But could you share a screenshot of the selection for P+ and P-? Perhaps I have an idea.

Stefan

Hi Stefan, thanks for the quick response

here the query:

and as you see, it works now, I just change the fill from (null) to (previous)… Magic … :smiley:

LG,
Andi

Cool, I suspected something like this. the two measurements may have slightly different timestamps and this may lead to strange things in time series queries.

yep, could be.
I’m just wondering why in the table view a result was displayed.
With the previous fill I will have a 5 sec delay, but I can live with that…

Thanks for your support!
Andi

Hi Stefan,

this solution is great. Can you implement the same on the Bar Gauge? That would be helpful.

Sebastian