home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.06k stars 2.78k forks source link

Statistics card has wrong Y-axis scaling #21883

Open RubenKelevra opened 2 months ago

RubenKelevra commented 2 months ago

Checklist

Describe the issue you are experiencing

I use a statistics card.

The Y-Axis is wrongly scaled, in Chromium and Firefox under Linux / Wayland / KDE as well as the Android App.

Screenshot_2024-09-04-23-08-16-755-edit_io homeassistant companion android

Screenshot_2024-09-04-23-08-30-691-edit_io homeassistant companion android

Screenshot_2024-09-04-23-08-55-731-edit_io homeassistant companion android

Describe the behavior you expected

The Y-Axis isn't properly spaced.

Steps to reproduce the issue

  1. Create a logarithmic scale graph
  2. See scaling issues in rendering

What version of Home Assistant Core has the issue?

2024.9.0

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Chromium / Firefox up to date, Android Apo up to date

Which operating system are you using to run this browser?

Linux / Android

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

karwosts commented 2 months ago

Can you elaborate a bit what is "wrong" about it? It looks reasonable to me for a log scale at a quick glance.

ildar170975 commented 2 months ago

what is "wrong" about it?

I am not OP, but for me this is obvious: image Distance between ticks is not consistent (cannot be logarithmic; or some "unusual" logarithmic value is used). And this could be an issue of chart.js.

Would be happy to be wrong.

karwosts commented 2 months ago

I didn't think tick spacing was typically consistent for log graphs.

loglog_h600-2627452637

ildar170975 commented 2 months ago

I mean - spacing presented on a screenshot does not seem to be correct in case of using "log10" or "ln". At least in part of maths (but may be I am wrong). Yes, these "logarithmic" scales do serve a purpose "show a trend for a quick glance" - but not correct mathematically. Anyway - I would not consider this as a "HA issue", this is a "chart.js issue".

karwosts commented 2 months ago

Looks like log10 to me:

image

ildar170975 commented 2 months ago

Interesting. I cannot verify your results right now. Probably you are right. Then - apologize for confusion from my side!

RubenKelevra commented 2 months ago

Oh sorry, that I wasn't clearer in my original post. I don't mean that the graph itself is wrongly plotted, just horizontal bars inside the Y axis are off:

My issue is the line at 15, while there's no line at 25.

And that there's no label on the lines below 10 makes it also very hard to read. Are those lines now "5, 0, -5" or "9, 8, 7"?

RubenKelevra commented 2 months ago

Another example of unlabeled grid lines, which make no sense.

And a graph with no upper end, making no sense either. The graph should always show an upper and lower bound, otherwise the portion above the last line has no meaning.

Screenshot_2024-09-09-13-13-33-598-edit_io homeassistant companion android~3

Can confirm for 2024.9.1