Plotly interactive Graph Card

That should be hovertemplate, see here: Hover text and formatting in JavaScript

please remember to google first, e.g “plotlyjs how to change hover text”

Hi

i found the above link already - unfortantely, I am not skilled enough to understand/know how to apply this to plotly in HA (should have it been an option in the yaml definition, good, but jumping into JS things is too much for me ;)).

I’ll live with the full hover text as it is, maybe finding some explanations later on how to implement/modify it.

Thanks !

Just write the object as yaml:

e.g:

What in js is:

hovertemplate: '<i>Price</i>: $%{y:.2f}' +
                        '<br><b>X</b>: %{x}<br>' +
                        '<b>%{text}</b>',

in yaml is:

hovertemplate: "<i>Price</i>: $%{y:.2f}<br><b>X</b>: %{x}<br><b>%{text}</b>"

or

hovertemplate: >-
    <i>Price</i>: $%{y:.2f}
    <br><b>X</b>: %{x}<br>
    <b>%{text}</b>

Regarding how to format other things, they are just conventions so it is a matter of reading their docs more than skill, I also go and read it when I try to do something different :slight_smile:

1 Like

While playing with your great add-on, I was wondering if it is possible to work with events like here: Hover Event

Thanks ! I actually tried this earlier, but was putting the parameter under “layout” - seems it must go under each entity :slight_smile:

Exactly!
See this message: Plotly interactive Graph Card - #663 by mateine

1 Like

Thanks!
plotly_hover is not connected at the moment. Feel free to open a feature request issue in the repo

I have a lot of false positives from a presence-sensor (mmWave). Is there any way I can filter these, say less than 30 secs, out from the chart?

maybe a resample followed by any averaging one

I tried resample but it’ll affect everything, not only the thinnest bars. I was more hoping for some kind of treshold function. Thanks for coming back to me!

Another thing I’m eager to know - I tried to “period: hour” on the particles entity but it came up blank. The sensor counts particles in a room, and it’s not a utility_meter or increasing, wouldn’t it be possible to “group” such entity? I just want to display the total amount of particles hourly.

Not resampling alone, add an averaging filter afterwards. That results in a low pass filter. You can then use - map_y: y>10?100:0 for example to apply a threshold

Good morning,
I tried to make a card as shown in the image, but something is missing.

I miss him:
remove the negative part, everything must start from 0
move the names to the bottom
put the kW high
I hope someone is able to help me
Thank you

11

I arrived here

17


type: custom:plotly-graph
entities:
  - entity: sensor.my_home_potenza_solare
    name: |
      $fn ({ ys,meta }) =>
        "Produzione" + " " + "(" +ys[ys.length - 1]+"kWh)"
    fill: tozeroy
    line:
      width: 1
      color: green
  - entity: sensor.my_home_potenza_del_sito
    name: |
      $fn ({ ys,meta }) =>
        "Prelievo" + " " + "(" +ys[ys.length - 1]+"kWh)"
    fill: tozeroy
    line:
      width: 1
      color: red
hours_to_show: 36
refresh_interval: 10
title: Produzione
layout:
  xaxis:
    rangeselector:
      'y': 1.2
      buttons:
        - count: 12
          step: hour
        - count: 1
          step: day
        - count: 2
          step: day
        - count: 7
          step: day

See the filters section in the readme. One of them is called (also) filter and allows you to remove datapoints.
Good luck!

I tried reading the filters section, but I didn’t understand how it works.
there is a simple command to limit the graph from 0 to +10 by eliminating the negative part
Example:

yaxis:
  - min: 0

Try:

entities:
  - entity: sensor.xyz
    filters:
      - filter: y>0
2 Likes

Hello,
I have now tried to use your values to make two template sensors, one for X from the second sensor (in the coordinate system of the first using your conversions) and one for y.
The results are really good, they are a bit out of sync sometimes but that’s probably due to placement of the sensors relative to eachother…

I would now like to set the background image of the chart card to an image of my floorplan to make some kind of a map of the room with the sensor data included.
How do I set the background image?

Best regards
Aaron Eisele

Look into the discussions, someone put a background image once in the past.

I searched for it before but I didn’t find an example of how to put such an image…

In the search field of the discussion section, type “background image” and don’t forget to pres enter.
I didn’t try it myself, but I remember somebody did it

The search can’t find it…