Skip to content

Statistics graph card: max line displayed compressed when min is also shown #28472

Description

@KevinCathcart

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

Several of my statistics graph cards are showing an issue with the max stat type, in line chart mode. The max graph does not fill up the entire width of the graph, but the max line does contain the data for the whole time period, it is just horizontally compressed such that the max may drop before the min.

Image Image

I'm seeing this with certain statistics that tend to change really slowly over many days, such that min and max are normally equal, but that very ocassionally have sudden rapid jumps. It does also happen with other stats that change rapidly, but it is normally harder to see, although it stand out somewhat in my CPU use graph:

Image

I have manually verified that the data in the database does not show any such anomaly, nor does the data in the websocket. Furthermore hovering the cursor over the graph always gives the correct min and max values for the horizonal position even when the cursor is placed past where the max graph ends, so this is just a display issue of some sort. It looks from dev tools that the data passed to <ha-chart-base> is still correct, so the issue might be at that level, or down in echart.

This issue only seems to occur if I am graphing both min and max (and optionally mean). Graphing mean and max, or min and mean and no similar anomolies are present.

A second possibly related anomaly is that if I click the legend to hide min, both min and max vanish (which may leave the graph blank unless I have mean displayed too, but hiding max only hides the max.) This also occurs for mean and max when hiding mean, so I assume this part has something to do with the banding code.

Describe the behavior you expected

The max graph should not be horizontally compressed. Clicking to hide the min would not hide the max.

Steps to reproduce the issue

  1. Create a card with an appropriate statistic like so:
chart_type: line
period: hour
type: statistics-graph
entities:
  - sensor.database_size
stat_types:
  - min
  - max
title: Database Size
days_to_show: 120

or

chart_type: line
period: hour
days_to_show: 30
type: statistics-graph
entities:
  - sensor.swap_use
stat_types:
  - min
  - max
title: Swap Use

What version of Home Assistant Core has the issue?

2025.12.0

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue?

Chrome 143.0.7499.41

Which operating system are you using to run this browser?

No response

State of relevant entities

Problem-relevant frontend configuration

JavaScript errors shown in your browser console/inspector

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions