-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] All axis same Zero line #428
Comments
@dbuezas any timeline? |
@Saentist make a feature request to plotly itself |
There is a manual workaround for this, but it's a bit clumsy. You have to set the range for each y axis manually, and the important part is that the ratio between maximum and minimums has to be the same for all axes in order for the zero line to coincide. For example, yaxis 1 has the range -10 to 100. Yaxis 2 with a range -4 to 40 would have a coinciding zero line, but one with a range -10 to 40 would not. You may also need to set the flag |
@caiusseverus Can you include some example of your suggestion. |
Yes, here's an example: Note that all axes have ranges with a scale factor of -4 between the minimum and maximum, so y1 is -1.25 to 5, y2 is -5 to 20, and y3 is -0.1 to 0.4. Here's what it looks like if I remove the manually set ranges All three axes now have different zero lines and the tick marks no longer line up. There is no way that I'm aware of to force it to use the same zero line while automatically scaling. |
@caiusseverus post YAML code if possible. |
I don't know what I would do with sun elevation on that graph. Here is the yaml though:
|
@caiusseverus cannot make it work with my config, any suggestions accepted type: custom:plotly-graph
defaults:
entity:
show_value: true
yaxes:
visible: true
showgrid: true
yaxis2:
visible: true
fixedrange: true
overlaying: 'y'
side: left
position: 1
title: radiation
rangemode: tozero
tickmode: sync
range:
- -0.1
- 1000
yaxis3:
visible: true
fixedrange: true
title: watt
overlaying: 'y'
side: left
anchor: free
autoshift: true
rangemode: tozero
tickmode: sync
range:
- -1.25
- 12000
hours_to_show: 12
autorange_after_scroll: true
refresh_interval: 10
title: Средна стойност за деня
layout:
legend:
orientation: h
itemsizing: constant
font:
size: 10
xaxis:
visible: true
fixedrange: false
domain:
- 0
- 0.95
rangeselector:
'y': 1.1
buttons:
- count: 30
step: minute
- count: 3
step: hour
- count: 6
step: hour
- count: 12
step: hour
- count: 1
step: day
- count: 3
step: day
- count: 7
step: day
entities:
- entity: sensor.ups_input_voltage
name: UPS V
- entity: sensor.ups_nominal_input_voltage
name: 230V
- entity: sensor.upsa_nominal_input_voltage
name: 220V
- entity: sensor.clamp_meter_voltage_2
name: clamp V
- entity: sensor.clamp_meter_power_2
name: clamp power
filters:
- multiply: -1
yaxis: y3
fill: tozeroy
- entity: sensor.output_1_wattage
name: MIN600Tl-x
yaxis: y3
fill: tozeroy
line:
color: lightgreen
- entity: sensor.8266_growatt_grid_active_power
name: 4200TL-XE
line:
color: green
fill: tozeroy
- entity: sensor.esp8266_sun_elevation
name: sun pos
- entity: sensor.sp2_watt
name: fridge
fill: tozeroy
yaxis: y3
filters:
- multiply: -1
- entity: sensor.smartplug3_power
name: serv
yaxis: y3
fill: tozeroy
filters:
- multiply: -1
- entity: sensor.power
name: LG
filters:
- multiply: -1
- entity: sensor.solar_radiation
name: Sun radiation
yaxis: y2
line:
- color: red
- entity: sensor.toko_price
name: тарифа |
I think you are going to have difficulties because you have so many entities overlaid on the same plot. You need to assign every entity to an axis, and then set the range for each axis so that the ranges have the same ratio between max and min. You may have to use a fixed scale rather than auto range after scroll. For example you have yaxis2 with range -0.1 to 1000 and yaxis3 with range -1.25 to 12000. If you change yaxis 3 to -1.2 to 12000 or -1.25 to 12500 then both have the same ratio of -10000. You also haven't specified the range for yaxis1, so that will change with the data. I would suggest separating some of these plots out into their own axes using the grid function, then you can group like data together, eg all voltages, all powers etc. Here is a thread that shows an example of that: #430 |
4 show Volts p.p.s. editing tool needed ;( type: custom:plotly-graph
defaults:
entity:
show_value: true
yaxes:
visible: true
showgrid: true
range:
- -10000
- 10000
yaxis2:
visible: true
fixedrange: true
overlaying: 'y'
side: left
position: 10
title: radiation
tickmode: sync
range:
- -0.1
- 1000
yaxis3:
visible: true
fixedrange: true
title: watt
overlaying: 'y'
side: left
anchor: free
autoshift: true
tickmode: sync
range:
- -1.25
- 12000
yaxis4:
title: Volts
overlaying: 'y'
visible: true
showgrid: true
side: right
anchor: free
autoshift: true
tickmode: sync
range:
- -10
- 260
hours_to_show: 12
autorange_after_scroll: true
refresh_interval: 10
title: Средна стойност за деня
layout:
legend:
orientation: h
itemsizing: constant
font:
size: 10
xaxis:
visible: true
fixedrange: false
domain:
- 0
- 0.95
rangeselector:
'y': 1.1
buttons:
- count: 30
step: minute
- count: 3
step: hour
- count: 6
step: hour
- count: 12
step: hour
- count: 1
step: day
- count: 3
step: day
- count: 7
step: day
entities:
- entity: sensor.ups_input_voltage
name: UPS V
yaxis: y4
- entity: sensor.ups_nominal_input_voltage
name: 230V
yaxis: y4
- entity: sensor.upsa_nominal_input_voltage
name: 220V
yaxis: y4
- entity: sensor.clamp_meter_voltage_2
name: clamp V
##################
- entity: sensor.clamp_meter_power_2
name: clamp power
filters:
- multiply: -1
yaxis: y3
fill: tozeroy
- entity: sensor.output_1_wattage
name: MIN600Tl-x
yaxis: y3
fill: tozeroy
line:
color: lightgreen
- entity: sensor.8266_growatt_grid_active_power
name: 4200TL-XE
line:
color: green
fill: tozeroy
- entity: sensor.esp8266_sun_elevation
name: sun pos
- entity: sensor.sp2_watt
name: fridge
fill: tozeroy
yaxis: y3
filters:
- multiply: -1
- entity: sensor.smartplug3_power
name: serv
yaxis: y3
fill: tozeroy
filters:
- multiply: -1
- entity: sensor.power
name: LG
filters:
- multiply: -1
- entity: sensor.solar_radiation
name: Sun radiation
yaxis: y2
line:
- color: red
- entity: sensor.toko_price
name: тарифа |
Officially plotly.py marked non sharing zero line as BUG |
All I can suggest is start from blank and add one entity at a time, allocating them each to axes as you add them. You should be able to see if it's working as intended. Trying to sort out all those different plots in one go is going to be a lot more difficult. If you don't want to delete everything completely, then comment out all the entities with a # at the beginning of the lines and uncomment them as you go. |
When there is a left and right set values they both have ZERO line but is on different location in graph.
Is there a option to have option to share same Zero line to graphs will be good visualisation option.
Additional context
The text was updated successfully, but these errors were encountered: