'Is there a way to overlay an on/off sensor over a graph in grafana?

I am using influxdb together with grafana to track temperatures in my house. I am also tracking some switches. One of the switches is connected to a heater, I want to see how the temperature outside relates to how often/long the heater is running. The heater just publishes a value of 0/1 for on/off so it is a little difficult to see the relationship in one graph.

I want to know if there is a way to have a filled-in background behind the temperature graph whenever the heater switch is on. Something similar to the time region feature of grafana, only with values from another source not time. A workaround (which I want to avoid), to better illustrate what I want, would be to have the value of 1 replaced by 200 and limit the graph to only display up to a more sane number. The result would be that the higher number of 200 is "off the charts" and I would see the fill of that graph.

Here is an image of the time region graph which is similar to how I picture what I am looking to do.

time region graph



Solution 1:[1]

graph with binary background

You can achieve the effect of background color by assigning the heater switch value to right y axis in the Visualization tab, setting axis limits to 0 and 1 and filling the area below the line with a solid color.

grafana visualization setting

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SimonFojtu