kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.96k stars 232 forks source link

Graph is jumping up and down on every graph update. #924

Closed Tontze closed 1 year ago

Tontze commented 1 year ago

Every second when graph is updated, whole graph line moves a lot up/down ? They also look completely different ? See pictures :

image image

ildar170975 commented 1 year ago

What else do you you expect with “points_per_hour: 1” ???? A real frequency is high, no wonder curves are different.

Tontze commented 1 year ago

I wouldnt expect it to move whole graph up and down every second and modify it all the way every second... I thought points per hour is for user, how often he wants have check point on the graph, but i assume it is much more.

How many point there should be for it to stop moving whole line up and down ?

Tontze commented 1 year ago

I hanged it to 60, jump is much smaller now, but it still happends. Added video, right after value change, whole line moves downwards...

https://user-images.githubusercontent.com/28216916/219937356-30d03e21-9573-4b45-8efd-493d4e9e0511.mp4

ildar170975 commented 1 year ago

Check this:

type: vertical-stack
title: sysmon::scan_interval
cards:
  - type: entities
    entities:
      - entity: sensor.processor_use
        secondary_info: last-changed
  - type: history-graph
    hours_to_show: 1
    refresh_interval: 0
    entities:
      - entity: sensor.processor_use
  - type: custom:mini-graph-card
    name: 30 sec
    hours_to_show: 1
    update_interval: 0
    aggregate_func: last
    smoothing: false
    lower_bound: ~0
    line_width: 1
    entities:
      - entity: sensor.processor_use
    points_per_hour: 120
  - type: custom:mini-graph-card
    name: 15 sec
    hours_to_show: 1
    update_interval: 0
    aggregate_func: last
    smoothing: false
    lower_bound: ~0
    line_width: 1
    entities:
      - entity: sensor.processor_use
    points_per_hour: 240

and then play with points_per_hour for the 1st "mini-graph-card". The real update frequency seems to be 15 sec (i.e. points_per_hour: 240). image

Note that:

  1. The history-graph shows EXACT changes.
  2. The 1st mini-graph-card has DIFFERENT curves if you watch it for 1 minute. And this is with a frequency "x2" of the real frequency - and then what you get with "points_per_hour: 1" ????)))
Tontze commented 1 year ago

Ok, i dont understand what you say, but im sure you are right :D Ill try to figure it out.

ildar170975 commented 1 year ago

I thought points per hour is for user, how often he wants have check point on the graph, but i assume it is much more.

IMHO the points_per_hour defines number of steps to calculate a curve.

Tontze commented 1 year ago

it gets quite funny if i remove whole "points per hour" line :D

https://user-images.githubusercontent.com/28216916/219938028-d2f33fee-1b22-464c-a61a-e921cf24894c.mp4

ildar170975 commented 1 year ago

Because of a default value of points_per_hour.