dbuezas / lovelace-plotly-graph-card

Highly customisable Lovelace card to plot interactive graphs. Brings scrolling, zooming, and much more!
402 stars 19 forks source link

Display min and max values on top of the trace as text, at the correct x positions #259

Open r-jean-pierre opened 1 year ago

r-jean-pierre commented 1 year ago

Describe the solution you'd like If not already asked, can we have the min and max value text on top of the curve?" it seems that plotly do not have this option right out the box, but they suggest to the users to construct this feature with the add_annotation feature (https://plotly.com/python/text-and-annotations/) and then, a possible result could be equivalent to:

image

How would it be defined in yaml?

type: custom:plotly-graph
entities:
  - entity: sensor.monthly_internet_energy
    show_extremas: true
dbuezas commented 1 year ago

wdyt about show_extrema or show_extremes or show_min_max_value ?

r-jean-pierre commented 1 year ago

All of them are okay. As a lazy boy I did the concatenation of

show:
  extremas: true

from the apex-charts card into show_extremas

But now I just realized that's wrong extremas with the S, it's a latin word, so: 1 extremum, several extrema, so apex-charts writes it wrong :)

dbuezas commented 1 year ago

exactly!

Heppi911 commented 3 weeks ago

I would love this feature as well. Same reason in my case. I want to move from ApexCharts to Plotly in home-assistant, but I miss these extrema feature. Especially because the tap to show datapoint info does work acceptable on mobile app.

dbuezas commented 3 weeks ago

@Heppi911 In the meantime you can use

entities:
  - entity: sensor.xxx
    statistic: max
    fill: tonexty
entities:
  - entity: sensor.xxx
    statistic: min
    fill: tonexty