Option to hide "min/max" legends in the statistics graph

-7em cuts of last 2 characters and replaces tem with ..., -6em does keep it, but ... is displayed instead for “(mean)”

text-overflow is probably still being overwritten by default

Update:
image


so far what I got

style:
  statistics-chart$ha-chart-base$: |
    .chartLegend li[title*=max] {
      display: none !important;
    }
    .chartLegend li[title*=min] {
      display: none !important;
    }
    .label {
      text-overflow: clip !important;
    }
    .label::after {
      content: "\00a0(mean)";
      margin-right: -7em;
    }

maybe one day i will understand the HA code enough to crate PR that will add that option


I guess the javascript injection would work same way as this GitHub - thomasloven/lovelace-card-mod: 🔹 Add CSS styles to (almost) any lovelace card right?

1 Like

It is fine there are third party alternatives and CSS, but shouldn’t really be necessary for something as simple as customizing the legend a bit.
It does not align well with the intent of making HA easier to use.

I too like the statistics-graph, especially now that it has gotten the stat type ‘Change’. Nice.

But I would really like to see the possibility to adjust the legend.
As I see it there could be three options:

  • Full (like now, could be default)
  • Minimal (one legend entry per sensor, no matter how many stat types are selected, and without (mean))
  • Off

If there is no space for it in the UI, just make it yaml only (like the entity name).

5 Likes

frontend/statistics-chart.ts at e14e27c01ab1725a132eb4ed33732b1902f25f75 · home-assistant/frontend · GitHub probably could be added here, but I did not still tried to follow instructions here Frontend development | Home Assistant Developer Docs and i developed kind of node.js alergy … mainly the later is the issue

there even already is hideLegend property that is not shown in visual editor.

Hi, I have used your CSS formatting and it works great on the PC, but on the phone it is not aligning properly. It is not matching the PC format, is it possible to have a CSS option that will match both PC & phone scaling? Please see attached picture.

Phone:

I think you would need to bother @piitaya directly to include switch to have visualization with mean max and min in chart, but not in the legend. Any css hackery like this will break in some use case on some change etc.
I kinda think there is some plan to make statistics/history or what is HA calling it (recorder vs non-recorder) work easier and plant might be they want to do nicer chart visualization components, so they do not spend time on improving current ones?

1 Like

As of the upcoming 2024.3, the statistics legend is reworked to only show one label per entity, and the text in the parenthesis is removed.

2 Likes