Not that I know of, no. The closest thing would be to cap the values using a filter. Plotly’s auto range is kind of limited
layout:
height: 600
Doesn’t work for you?
What layout are you using? (Masonry, sections, …)
Yes I think there’s a way to sync the zero between yaxes.
tickmode: sync
or similar
i am using sidebar layout, and setting the height in layout will change the height, but it does not go the full height. at the moment i have it at 1500 to test, and checking dev tools it only expands up to 450.
That is a useful setting as it allows the tick lines to sync up, but it doesn’t require (or force) the zero point on both axis to be the same. though thanks for the setting it makes it easier to read the graph as it stands
Hello mateine!
The plotly-graph is really one of the nicest add-ons to make data look nice
I got a little issue, where I can’t find a solution myself - so let’s ask:
I monitor my Synology NAS and set up a graph to see the up-/download. It looks like this:
As you may see - the yaxis has the label “kB/s” and the graph goes to something around 23k. Basically thats 23000 kB/s, but it’s really confusing to read due to the double kilos (23k kB/s).
Is there some easy way to adjust that to MB/s in the yaxis attribute, or do I need to set up a helper do do that?
Thanks!
Sure, override the unit_of_measurement and use a multiply filter to apply a 1e-3 factor. Search for those keywords in the readme of this component
Oh no. What a pity. Thought I only didn’t find the most obvious because for me it is somehow basic requirement.
Because in my case the auto range of a sensor with value 0 shows -0.5 to 0.5. But the sensor is not build to be below 0 (e.g. rain), so I wanted to set 0 as lower range in the graph but have the max auto according to the values of the timeframe.
But thanks for your answer anyway.
you could cap it to 0 with a filter: - map_y: Math.max(0,y)
Awesome!
Works!
Don’t get it completely. It is already >=0, but y-axis still show -1 to 1.
type: custom:plotly-graph
time_offset: 1.5d
entities:
- entity: sensor.weather_home_hourly
attribute: precipitation
filters:
- map_y: Math.max(0,y)
hours_to_show: 48
I assume because there’s only one y value
Anyone already changed the tickformat to local format
If I do it via
xaxis:
tickformat: '%H:%M<br>%d. %b'
I’m close
but you see, that now the date is repeated every tick and not as in standard, where it is in this case only on 00:00.
Andy idea/way to have it as in standard but localiced?
Hi!
Due to end-of-life of history explore card, I’m switching to plotly.
First of all congratulations for your card.
I’m currently trying to recreate one fo my cards (this one) with plotly.
I have a problem: as soon as I try the fill option, the yaxis goes to zero.
I would like to maintain:
- both dynamic yaxis
- and fill
Anybody knows a solution?
I found this topic: Maintain min/max axis control while still filling down to y axis as with fill='tozeroy' - 📊 Plotly Python - Plotly Community Forum
Is it possibile to achieve something like that in home assistant plotly integration?
Thank you very much
Andrea
I’m working on this very simple graph
type: custom:plotly-graph
entities:
- entity: sensor.temperatura_app_9_camera_andrea
name: temperatura
fill: tozeroy
fillcolor: rgba(244,209,96,0.3)
line:
color: rgba(244,209,96,1)
width: 2
show_value: true
type: line
hours_to_show: 6
refresh_interval: 60
autorange_after_scroll: true
layout:
showlegend: true
xaxis:
rangeselector:
'y': 1.15
buttons:
- count: 30
step: minute
- count: 1
step: hour
- count: 6
step: hour
- count: 12
step: hour
- count: 1
step: day
- count: 7
step: day
It’s not dead, another one took over development:
https://github.com/SpangleLabs/history-explorer-card
For now remove current card and manually install new one is only option, but things are looking good.
Great news! Thank you very much!
Hi @mateine
Plotly is working great over here and many thanks for your continuous support for everyone!
Just a question, are you aware if there is a DatePicker component available for plotly?
Maybe I’m totally wrong and it’s something totally different, but I saw in plotly dash there is a DatePickerSingle & DatePickerRange component available:
Would be absolutely great to being able to select a specific date/range.
Thanks for your kind words
I’m not aware of a date picker in ploylyjs, are you sure this is not just dash?
Howdy, I love this card and it is so feature rich I am getting a bit lost in its capabilities.
I am trying to get a hover template to calculate the cost of the kWh recorded on the stacked bar graph. I have a fixed cost of .092 per kWh however for some reason Cost: $%{customdata.cost} only prints literally “$%{customdata.cost}”
I know I am missing something, can you assist?
- entity: sensor.pumphouse_controller_jet_pump_energy
statistic: state
name: Jet Pump
unit_of_measurement: kWh/d
texttemplate: '%{y:.2f}'
customdata: |
$fn ({states}) =>
states.map(state => ({
cost: (parseFloat(state.state) * 0.092).toFixed(2)
}))
hovertemplate: |
$fn ({ getFromConfig }) =>
`Date: %{x}<br>
<b>${getFromConfig(".name")}</b><br>
kWh: %{y:.2f}${getFromConfig(".unit_of_measurement")}<br>
Cost: $%{customdata.cost}
<extra></extra>`
period: day
type: bar
filters:
- derivate: d
marker:
color: '#4682B4'
Happy to hear that!
Try adding formatting: %{customdata.cost:.2f}