-
Hi there, I have the following code to display two graphs for temperature and humidity which I adapted for the 3.0 release according to https://community.home-assistant.io/t/plotly-interactive-graph-card/347746/207
It seems that the When I adapt the yaxis2, it shows both y-axes on the left:
Am I doing something wrong here? Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hello, I don't think you need to define the yaxis in entities, it should work out of the box as long as the HA entities have the right unit_of_measurement, same thing for legendgroup, it isn't needed. Here is the yaml of one of my plot. It's more than what you need, but you will see that I didn't had to specify axis. There are some properties for them in the layout to customize them, but it's not needed to get them both. type: custom:plotly-graph
time_offset: >-
$fn () => (864e5+(new Date()).getTimezoneOffset()*6e4-(Date.now() % 864e5)).toFixed(0) + 'ms'
defaults:
entity:
showlegend: false
type: line
entities:
- entity: sensor.tmp_dehors_temperature
name: Hier
time_offset: 1d
line:
color: '#ff7f0e'
opacity: 0.6
filters:
- force_numeric
- resample: 5m
- sliding_window_moving_average:
window_size: 15
extended: true
centered: true
- entity: sensor.tmp_dehors_temperature
name: Temperature
line:
color: '#ff7f0e'
filters:
- force_numeric
- store_var: temp_today
- resample: 5m
- sliding_window_moving_average:
window_size: 15
extended: true
centered: true
- entity: sensor.tmp_dehors_humidity
name: Hier
opacity: 0.6
line:
color: '#1f77b4'
time_offset: 1d
filters:
- force_numeric
- resample: 5m
- sliding_window_moving_average:
window_size: 25
extended: true
centered: true
- entity: sensor.tmp_dehors_humidity
name: Humidity
line:
color: '#1f77b4'
filters:
- force_numeric
- store_var: hum_today
- resample: 5m
- sliding_window_moving_average:
window_size: 25
extended: true
centered: true
- entity: sensor.nothing_now
name: now
yaxis: y9
line:
width: 1.5
dash: dot
color: '#803c00'
filters:
- force_numeric
- fn: () => { return {xs:[Date.now(),Date.now()], ys:[0,1]} }
layout:
showlegend: true
yaxis:
title: $fn ( { vars } ) => 'Temperature (' + vars.temp_today.ys.slice(-1) + '°C)'
titlefont:
color: '#ff7f0e'
yaxis2:
title: $fn ( { vars } ) => 'Humidity (' + vars.hum_today.ys.slice(-1) + '%)'
titlefont:
color: '#1f77b4'
yaxis9:
rangemode: tozero
dragmode: false
config:
scrollZoom: false
hours_to_show: 24
refresh_interval: auto
title: Climate outside vs yesterday |
Beta Was this translation helpful? Give feedback.
-
This may be a bug in my logic that overrides defaults in a cascading manner. Will take a look. It's odd because I am using something extremely similar and it works fine. |
Beta Was this translation helpful? Give feedback.
-
Indeed, v3.2.0 (latest) works fine with the yaxes defaults: Ok, you are using v3.0.0, that's releases old. Highly recommend to upgrade, it fixes the bug you encountered and adds some extra filters and flags (like the |
Beta Was this translation helpful? Give feedback.
Indeed, v3.2.0 (latest) works fine with the yaxes defaults:
Ok, you are using v3.0.0, that's releases old. Highly recommend to upgrade, it fixes the bug you encountered and adds some extra filters and flags (like the
hours_to_show: current_day
)See here: https://github.com/dbuezas/lovelace-plotly-graph-card/releases