# Display of charts for binary sensors

**URL:** <https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599>\
**Category:** Demandes livrées\
**Tags:** dashboard, feature-core, graphique\
**Created:** [October 13, 2021, 10:43am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599 "2021-10-13T10:43:01Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 2, 2024, 4:22pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/81 "2024-09-02T16:22:26Z")

</div>

> [@Terdious](#):
>
> I just pushed, @pierre-gilles does Cloudflare restart automatically or is it a manual action on your part?

It’s a manual action. Afterwards, if you want to share Cloudflare links more easily, you can configure Cloudflare on your Gladys repo and it will create the links automatically 😉

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 2, 2024, 7:51pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/82 "2024-09-02T19:51:38Z")

</div>

Okay everything’s done, I only have the reordering left… a pain and the tidy-up.

I looked a bit into Cloudflare, created an account and a Page linked to my fork… but it doesn’t give much ^^

Edit: Reordering of the binary charts (order of display on the dashboard) done. Now all that’s left is to retest. @pierre-gilles if you can restart Cloudflare, or if you have time, guide me so I can do it ^^

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 3, 2024, 6:59am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/83 "2024-09-03T06:59:18Z")

</div>

I’m at work today and tomorrow so not possible, but I’m surprised you can’t do a Cloudflare Pages build — it’s normally done in a few clicks.

Did you push a commit after configuring the builds?

Maybe try searching for a Cloudflare Pages tutorial on Google 🙂

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 3, 2024, 7:59am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/84 "2024-09-03T07:59:18Z")

</div>

Thanks for your reply ^^

I’ll look into it a bit more … ^^ for now my test was to go to the «&nbsp;Workers and Pages&nbsp;» tab

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 3, 2024, 4:22pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/85 "2024-09-03T16:22:06Z")

</div>

My configuration:

#### Build configurations

**Build command:** cd front && npm run build  
**Build output directory:** /front/build  
**Root directory:** /  
**Build comments on pull requests:** Enabled

Environment variables:

| Variable name | Value |
| --- | --- |
| `CYPRESS_INSTALL_BINARY` | `0` |
| `GATEWAY_MODE` | `true` |
| `NODE_VERSION` | `18` |
| `SERVER_URL` | `https://api.gladysgateway.com` |

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 3, 2024, 5:15pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/86 "2024-09-03T17:15:47Z")

</div>

A big thank you to you, it works perfectly!!  
@guim31 and those interested, the Gladys Plus link to test [Gladys Assistant](https://terdious-add-binary-chart.pages.dev/login?return_url=%2Fdashboard)  
:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/2/e/2e4bfe7f46aabea1d363edf76a85cda1bd841b85.png)  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/3/e/3e39f7bcdd788633eae918003dd78c60945392a4.png)

Display without modification with default order:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/3/9/3982698a8e282c40151f92cf0b6b8963eb4c0344.png)  
After renaming and reordering:  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/0/1/010d26acbefb3f59f83ecb56f5d030e710258bc9.png)

> [@guim31](#):
>
> I would have liked to be able to rename my feature (like in Room device) because it’s too long as it is ^^

It’s done!!

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [September 3, 2024, 7:44pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/87 "2024-09-03T19:44:26Z")

</div>

@Terdious ,

I just tried it and when there’s a lot of data it’s not really usable.  
At the same time it’s hard to do better; maybe try showing the curve in 1 column

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/b/7/b72ceb5ae8467d81e23c3678dff1f11fa1c71275.png)

Otherwise it’s OK

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/5/6/5636d3a2406dd54681b98a82a010a946c515d7d7.png)

One other small detail — well, I find it odd. When you hover over a curve on a chart with multiple curves, it highlights all the curves.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/e/b/eb9ca2d83d2eee9bef50bd19d5d205a72e13aacc.png)

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 4, 2024, 6:46am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/88 "2024-09-04T06:46:01Z")

</div>

Hi @_Will_71,

Thanks for your test, the advantage of front-end PRs is being able to test quickly and easily, it’s great ^^

> [@\_Will\_71](#):
>
> I’ve just tried it and when there’s a lot of data it’s not really usable.  
> At the same time it’s hard to do better, maybe try displaying the curve in 1 column.

Indeed, for sensors like detection that jump to 1 in a matter of seconds, the results aren’t visually clear over 24h. Have you tried zooming (currently possible only on desktop I think)? It works fine for me.  
As you say, hard to do better. For this kind of case. The PR on the expand should help too.

> [@\_Will\_71](#):
>
> to try displaying the curve in 1 column

I’m making a new test build with the two PRs combined if you want to test: [Binary + Colonnes dashboard](https://terdious-binary-and-columns-dashboard.pages.dev/)  
I can’t separate the row highlighting because it highlights the value «&nbsp;on&nbsp;» or «&nbsp;off&nbsp;» which is the same for all the graphs. But I can remove the highlighting if needed!

So in 2 columns it looks like:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/0/1/01aedaa00bdc44957de4ce897a758a5d288e1f10.png)

And if we zoom on a part with fleeting appearances:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/9/7/97c25b30c57d47b2cd45259a3d4ac224ada67351.png)  
So it works quite well when zooming. The problem mainly occurs on mobile as long as you can’t zoom.

And in 1 column (which won’t change anything on mobile, maybe just on tablet):

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/8/d/8dcac665c06b3aba401cb5475be11fe0def7bbf7.png)  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/2/7/27ab78e66b16afd353810a0c864c714461cfd9ba.png)

Anyway, over 24h the goal is only to roughly spot where the detection zones are. Then zooming (thanks to the real values) allows quickly identifying the trigger times.

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [September 4, 2024, 11:00am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/89 "2024-09-04T11:00:12Z")

</div>

[quote=«&nbsp;Terdious, post:88, topic:6599&nbsp;»]  
I’m making a new test image with the 2 PRs merged if you want to test: [Binary + Columns dashboard](https://terdious-binary-and-columns-dashboard.pages.dev/)

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 4, 2024, 11:06am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/90 "2024-09-04T11:06:00Z")

</div>

You can test again if you want @_Will_71, I’ve revised the highlighting. I’ve also adjusted the display heights of the timelines so it’s more consistent when one or more binaries are displayed. You can directly

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [September 4, 2024, 7:11pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/91 "2024-09-04T19:11:16Z")

</div>

With one column the display is a bit better; as for the zoom, I love it  
Great work!

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/d/6/d6d3521d0d7086ff1da97aec7dd7fa66549d1272.png)

The change you made with the highlighting I find more natural — the highlight is only under the mouse and only on the curve under the mouse. However, if you place yourself below on the On for example, then it selects the On in all curves. Personally I prefer it that way.

I do have a few remarks:

I have the date appearing on the same line as the time  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/6/8/689090167c3b62094dbbaf3e778694ad74a4c147.png)

I have white lines appearing everywhere. The On area is cut into several pieces  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/7/770aeeca3772babce298b967efa3b552768649cd.png)

If I zoom in, you can see that the first On ends at 22:13:11.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/4/4/4470a44f5cf07d838c68c68593f25ffb8c4102f5.png)

And the second On starts at 22:13:11. There is no Off area between the two so why this segmentation?

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/4/748364add3288e7c7ce811f2baa84df61b748ad0.png)

When zooming it would be good to have the scale at the bottom. There is indeed a value at the bottom left but it should be converted.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/a/b/abc4282aa115ca5e68d7b51384e09e8b54b65063.png)

Can’t wait for this to be merged!

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 5, 2024, 7:28am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/92 "2024-09-05T07:28:41Z")

</div>

> [@\_Will\_71](#):
>
> J’ai la date qui apparaît sur la même ligne que l’heure  
> ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/6/8/689090167c3b62094dbbaf3e778694ad74a4c147.png)

Yes, it’s like that for all the graphs when the display overlaps multiple days ^^. Example on my prod instance:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/f/b/fb80d6af834a6efe3783e69338afe86fe54ca196.png)

> [@\_Will\_71](#):
>
> J’ai des traits blanc qui apparaissent un peu partout. La zone On est découpé en plusieurs morceaux

Indeed I can reproduce it, I’m looking into it. I don’t yet understand the reason. Do you know if during that interval there should have been an Off area, or if there really were no changes?

> [@\_Will\_71](#):
>
> Quand on fait un zoom il sera bien d’avoir l’échelle en bas. Il y a bien une valeur en bas à gauche mais il faudrait la convertir.

Lol you zoomed in really far ^^ You reached a display order in milliseconds, so I wasn’t handling it ^^  
I struggled but apparently it’s fine: I limited the zoom to a scale of 1s (I think we all agree there’s little point going below that?) So we display a minimum of 10s. If you try to zoom again, it just shifts.  
Zoom max :

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/c/4/c4b8ca35b6139a9ea4ecc4c39e5e2af782dee62a.png)

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 5, 2024, 9:15am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/93 "2024-09-05T09:15:38Z")

</div>

> [@\_Will\_71](#):
>
> J’ai des traits blanc qui apparaissent un peu partout. La zone On est découpé en plusieurs morceaux  
> ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/7/770aeeca3772babce298b967efa3b552768649cd.png)
> 
> Si je fait un zoom, on voit que le premier On fini à 22:13:11.
> 
> ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/4/4/4470a44f5cf07d838c68c68593f25ffb8c4102f5.png)
> 
> Et le deuxième On commence à 22:13:11. Il n’y a pas de zone Off entre les 2 alors pourquoi ce découpage?
> 
> ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/4/748364add3288e7c7ce811f2baa84df61b748ad0.png)
> 
> Quand on fait un zoom il sera bien d’avoir l’échelle en bas. Il y a bien une valeur en bas à gauche mais il faudrait la convertir.
> 
> ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/a/b/abc4282aa115ca5e68d7b51384e09e8b54b65063.png)

> [@Terdious](#):
>
> En effet je reproduis, je regarde ça. Je n’en comprends pas encore la raison. Sais-tu si sur cet intervalle il y aurait dû y avoir une zone off, ou si vraiment il n’y avait aucun changement ?

Damn I found it … ^^ It’s nonsense ^^

This happens for binary sensors that send more than 100 data points in 1h (or in 24h depending on what’s displayed). They return an aggregate. So if we only have 1s and a single «&nbsp;0&nbsp;» appears, it averages to «&nbsp;0.5&nbsp;» so we do have a different value, but it doesn’t know how to represent it…

Maxstate = 100 zoomed:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/9/4/94d982e3af6b4ec4ab97332d8cdefe96afd2a981.png)

Maxstate = 1000 zoomed:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/4/2/4261ca0dd1bc7f112f9610c3fd49bb32a37cef0b.png)

So @pierre-gilles, I don’t really know what to do in this case… for a 1h display, I was planning to set 1000 states, but it will probably be the same if the device sends a value every 5s for example, because «&nbsp;Last hour&nbsp;» already returns 3h currently on all the charts… (I suppose it uses UTC time - haven’t looked at the server-side code).

Well in my case 1000 states max fixes the issue for «&nbsp;Last hour&nbsp;», but I still have the case for 24h.  
Otherwise I can set 10000 states… but …

In 24h, 1000 states:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/2/c/2cc58143603d71b101771607ba4da37aa7580631.png)  
In 24h, 10000 states max =\> 1600 actually (you can clearly see that this is not at all reality compared to the one above, between 10:06 and 10:08 we had a short On and then a long Off before going back to On):  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/c/e/ce21b9c33aae57eb0633e49a9be5bb2c3a0c2e66.png)

EDIT: 3000 states max … that makes one value every 30s. That would roughly match reality. And for the rest we’ll see in one of the next PRs with recalculation on zoom??

I’ll let you test again on [https://terdious-binary-and-columns-dashboard.pages.dev/](https://terdious-binary-and-columns-dashboard.pages.dev/) (not before 10 minutes) but I’d say it’s not too bad!

---

<div class="post-metadata">

**Author:** ![Will\_71](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/will_71/32/9582_2.png) [@Will\_71](https://community.gladysassistant.com/u/Will_71)\
**Post date:** [September 5, 2024, 7:47pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/94 "2024-09-05T19:47:32Z")

</div>

> [@Terdious](#):
>
> Yes, it’s like that for all the charts when the display spans multiple days ^^. Example on my prod instance

I had never noticed before but it’s not always present, it depends on the schedule.  
Example below:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/2/f/2f9077f96ee7698b1befbc2d94b27ef02e21a5e1.png)  
I don’t know why but on my prod the day appears in bold.

> [@Terdious](#):
>
> Indeed I can reproduce it, I’ll look into that. I still don’t understand the reason. Do you know if during that interval there should have been a downtime, or if there really was no change?

I don’t have any downtime.

> [@Terdious](#):
>
> Lol you zoomed in a lot ^^ You ended up at a display scale in milliseconds, so I wasn’t handling that ^^

Yes I was trying to understand if there was an off period.

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 5, 2024, 8:02pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/95 "2024-09-05T20:02:06Z")

</div>

> [@\_Will\_71](#):
>
> that depends on the schedule

Yes that’s it!!

> [@\_Will\_71](#):
>
> I don’t have an Off zone.

Ah ok, surprising. If you can try again (I’ve updated), because for me it brought up Off zones (consistent with

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 10, 2024, 4:40pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/96 "2024-09-10T16:40:43Z")

</div>

> [@Terdious](#):
>
> EDIT : 3000 states max … that makes one value every 30s. That would roughly correspond to reality. And for the rest we’ll see in one of the next PRs with the recalculation on zoom ??

Doesn’t that impact performance too much with 3000 states?

And if there are only 10 states, we agree it won’t add fake states to reach 3000?

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 10, 2024, 5:19pm UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/97 "2024-09-10T17:19:08Z")

</div>

> [@pierre-gilles](#):
>
> Doesn’t that affect performance too much with 3000 states?

I tested with 3 features on the same graph, I didn’t see any difference. But I can test with 10 graphs of 5 features to be sure.

> [@pierre-gilles](#):
>
> And if there are only 10 states, we agree that it doesn’t add fake states to reach 3000?

I confirm, it’s indeed state\_max. I haven’t touched the system

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 11, 2024, 3:42am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/98 "2024-09-11T03:42:43Z")

</div>

Okay, I just ran tests again. It’s nowhere near as responsive as my previous tests. I don’t know what changed in a few days.

The problem is that if we don’t have all the values, as mentioned earlier for binaries everything is averaged, which skews everything because we get states ‹&nbsp;0.333&nbsp;›, ‹&nbsp;0.5&nbsp;›, ‹&nbsp;0.66667&nbsp;› and others that can appear when switching to 0 or to 1. And which, moreover, are not time-accurate.

Visual differences in my use case with a presence sensor:

- For 2000 or 3000 states - display takes more than 5s (with 4 other curves) :  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/5/4/54b35bf1b9ec180739a3698722c5abccf7e3b935.png)
- For 1000 states display in 3–5s (with 4 other curves) :  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/a/7abc9215b5ac759c6122b16429bf674958350951.png)
- For 500 states display in 1s (with 4 other curves) :  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/a/5/a5478eb81e02f542fcfbd0ce632c229a622ab002.png)

My issue lies in processing the averaged states to give them a coherent value.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/4/a/4a31bae481855fcfdb55ba0b9c4e71e711d1e37e.png)  
Taking 3000 states, I know that the first state is ‹&nbsp;1&nbsp;› in this case. But how do you ensure that’s always the case? And if we take the example of a blinking signal, how does the averaging behave… only 0.5? How do we interpret that?  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/d/7dd1a203674fd61887ec55d218e6e314ea5a19c4.png)  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/2/1/21a55db1447dc50dbf2f4e4011646795343b26f4.png)

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 11, 2024, 7:01am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/99 "2024-09-11T07:01:59Z")

</div>

I can’t see the point of displaying so many points.

The user won’t even see the tiny marks; they’ll be smaller than a screen pixel… It’s unusable!

Why not restrict the display duration? 1h for example?

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [September 11, 2024, 8:08am UTC](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599/100 "2024-09-11T08:08:42Z")

</div>

That’s exactly the issue… We’ve already restricted the display to 24h; beyond that it doesn’t make sense. But there are 2 points to consider :

- Sensors that send every x seconds
- Sensors that send on state change, for example a switch (which will remain on longer).

1. It would be a shame to penalize the view of the second, which is largely readable:  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/f/a/fa406b0c9d91cd628347c86b25a26e81e6fcb2f7.png)
2. The interest for the first is that it’s useful to be able to consult a full day and to zoom in to see more clearly — for example here you can clearly see that between 11:00 and 13:00 yesterday there was a presence detection:  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/7/4/743aa94b14b150afe66b8bd350d53635c3d2c2c3.png)  
=\> if I zoom in on 11:50–12:10 yesterday it becomes perfectly readable and I see that I had a presence of 10s at 11:50. So fully exploitable.  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/a/f/af8029d1265b6cce533d6bcbeaf8e3c2cde6c54d.png)  
The idea will then be to be able to recalculate on zoom. (For example have all exploitable data and be able to zoom on the red area to retrieve data not visible on the initial view)

**If you have a bit of time during the week for a video call with visuals, I’m very interested.** Because I’ve revised my implementation; however it’s no longer testable from Gladys Plus unfortunately, I’m «&nbsp;forced&nbsp;» to make server-side changes.

I added a specific query for ‹&nbsp;binary&nbsp;› features and limited the number of results to 300.

The only thing that bothers me is that it worked so well last time at 3000 states that I’m really surprised by the radical change today. I’m afraid my PC is kind of on its last legs (but I can’t restart it. I’d need to set up a new machine for dev. But no time or resources.

That said, I think the method is better because we organize the data directly in the query.  
We’ll then need to add the recalculation of values on zoom.

[Previous page](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599.md?page=4)

[Next page](https://community.gladysassistant.com/t/affichage-des-graphiques-pour-les-capteurs-binaires/6599.md?page=6)
