kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.87k stars 231 forks source link

Sporadic data showed wrong from origin #1034

Closed emandtf closed 5 months ago

emandtf commented 7 months ago

Let me prepare an example:

  1. latest 12h on X-axis
  2. first data available from "now - 9h" (it means at about 1/3 of X axis)
  3. all previous 3h are showed at the same value of the first available record value

20231124_wrong_graph

As you can see the whole rounded-in-red part is displayed by the Chart but there aren't any data there. The very first and existent record is the first on the right-side of the red-border.

This happens in both "bars" and "lines" mode.

ildar170975 commented 5 months ago

Unclear. Please provide more detailed description & a short minimal code.

emandtf commented 5 months ago

minimal code.

Minimal code of what? It's Homeassistant YAML, not a programming language/software with its code 😅

I have a sensor that stores a temperature every X hours, so if the x-axis represents 24h I'm expecting only 4 "peaks"/bars at regular interval but instead I get N bars starting from the origin (0,0) until first data is reached and all these bars (that have NO ANY data in the database) have the "first data" value. Screenshot previously attached (and its description) is very clear. I'm expecting NO BARS starting from the left until first data is met, and not N fake bars starting from origin which have the same value of the first available data that occurs in the middle of X-axis 😅

ildar170975 commented 5 months ago

t's Homeassistant YAML, not a programming language/software with its code

yaml code.

Also provide a standard history-graph for the same hours_to_show. 1 picture is worth 100 words.

emandtf commented 5 months ago

1 picture is worth 100 words.

I've already attached a screenshot at the first post 😅

This is the "code" :

  • type: custom:mini-graph-card entities:
  • entity: sensor.openwrt_cpu_temperature hours_to_show: 58 show: graph: bar
    • type: history-graph entities:
  • entity: sensor.openwrt_cpu_temperature hours_to_show: 58

and this is the picture SmartSelect_20240118_233317_Home Assistant that is "the same" of before 🤷‍♂️

Mini-chart starts to show some values starting from origin even if the data are not present in the DB. And these values (before the first valid one) has the same value of that first valid.

ildar170975 commented 5 months ago

This is the "code" :

Although the posted code is clear - it is still unformatted and cannot be used to copy/paste. If you need to be helped - try to cooperate, otherwise you will not get a support, issue will be closed. "Formatted" - check other issues how people format a code.

Edit your code as follows:

  1. Replace bar with line.
  2. Define points_per_hour close to the actual frequency of your readings.

Then post the FORMATTED code & screenshot.

ildar170975 commented 5 months ago

Closed as heated.