# Overlay Binary data on temperature graph

**URL:** <https://community.grafana.com/t/overlay-binary-data-on-temperature-graph/50814>\
**Category:** Grafana\
**Created:** [July 21, 2021, 6:16pm UTC](https://community.grafana.com/t/overlay-binary-data-on-temperature-graph/50814 "2021-07-21T18:16:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jollyrgrsbot](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jollyrgrsbot/32/17757_2.png) [@jollyrgrsbot](https://community.grafana.com/u/jollyrgrsbot)\
**Post date:** [July 21, 2021, 6:16pm UTC](https://community.grafana.com/t/overlay-binary-data-on-temperature-graph/50814/1 "2021-07-21T18:16:43Z")

</div>

Hello,

I’m using Home Assistant and have integrated InfluxDB and Grafana. I have a panel to show when my AC is running or not (data comes in as a 1 or 0 for on or off). I have other panels that show the temperature reading on various rooms or the thermostat itself. I’d like to overlay all on one graph. My trouble is the binary on/off data (as 1 or 0) on a graph normally in the 60s or 70s (degrees F).

I understand I may just be missing something stupid (I’m new to Grafana). Is there a way to override the 1/0 so I can make it the min/max of the other values? Am I just missing the right keywords to google/search to find the feature I’m looking for to do this?

Currently, I do math \*100 on the binary value, but it jacks with my auto min/max

 ![grafana_panel](https://us1.discourse-cdn.com/grafana/original/3X/d/8/d8b34115a07d8d273c3fa59f61927c6a1f55ff0a.png)

I’d like to have the on/off binary functions just be at max/min of whatever the graph is. If I’m doing this completely wrong, feel free to give me some pointers. I want to learn more of this, I just ran out of keywords to search, so I came here to ask for help.

---

<div class="post-metadata">

**Author:** ![svetb](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/svetb/32/3307_2.png) [@svetb](https://community.grafana.com/u/svetb)\
**Post date:** [July 21, 2021, 9:14pm UTC](https://community.grafana.com/t/overlay-binary-data-on-temperature-graph/50814/2 "2021-07-21T21:14:22Z")

</div>

There is a secondary Y-axis option that would work well here. Basically plotting the 0/1 series on a separate (0-1) scale.

The way you set it up will depend on whether you’re using the “legacy” graph panel, or the new time-series panel (can’t quite tell from the screenshot). Maybe poke around the docs and/or the config options and see if it works for you - happy to share some more pointers if you can’t get it to work.

---

<div class="post-metadata">

**Author:** ![jollyrgrsbot](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jollyrgrsbot/32/17757_2.png) [@jollyrgrsbot](https://community.grafana.com/u/jollyrgrsbot)\
**Post date:** [July 22, 2021, 6:48am UTC](https://community.grafana.com/t/overlay-binary-data-on-temperature-graph/50814/3 "2021-07-22T06:48:02Z")

</div>

Thanks so much svetb! secondary Y-axis was the missing key to my joy.  
Here’s the result I have so far. I have one last issue which I might not be able to get around. The legend cannot be overridden for specific queries, so it is an all of nothing. I don’t need last or max for the AC functions, just for the temps.

 ![full_panel_24](https://us1.discourse-cdn.com/grafana/original/3X/0/7/07fb7f36035a6b953c24ab7dfee6ef0f638471d8.png)  
 ![full_panel_3](https://us1.discourse-cdn.com/grafana/original/3X/d/1/d14d53e6e23ab5a0674e9a5b9360b29541546393.png)

I am on Grafana 7.0.4 (the container that Home Assistant creates, so I am at the mercy of HA as to when it updates). To explain what I did, I could not figure out why everything was going left or right for the axis. The split axis worked when I specified the unit for my binary queries. They show as type “state” in the query. I set them to unit boolean. I also had already set a value mapping for 1=On and 0=Off for the 3 AC mode queries. After setting the first query (Cooling) to left, the other 2 modes did not need any overrides. All 3 did need the override for the unit though.

I have a sister query for each of the temps where it just grabs the max and plots a single point, giving me a nice visual on the line where the max for that time range.  
Idealy, I would have loved to have a label on the graph point itself for the max, but I’ll settle for if I can have it display in the legend. The drawback is that the AC modes also display the same Last and Max, which just clutters it up (and makes it 2 lines).

---

<div class="post-metadata">

**Author:** ![svetb](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/svetb/32/3307_2.png) [@svetb](https://community.grafana.com/u/svetb)\
**Post date:** [July 22, 2021, 11:22am UTC](https://community.grafana.com/t/overlay-binary-data-on-temperature-graph/50814/4 "2021-07-22T11:22:12Z")

</div>

> [@jollyrgrsbot](#):
>
> I have one last issue which I might not be able to get around. The legend cannot be overridden for specific queries, so it is an all of nothing. I don’t need last or max for the AC functions, just for the temps.

Indeed, that’s not currently possible.

I wasn’t 100% clear on your follow-up questions, but it sounds like you’ve mostly got it working now

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [July 21, 2022, 6:17pm UTC](https://community.grafana.com/t/overlay-binary-data-on-temperature-graph/50814/5 "2022-07-21T18:17:30Z")

</div>

Closed on July 21, 2022, 6:17pm UTC

This topic was automatically closed after 365 days. New replies are no longer allowed.
