-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
End the graph line with a marker and current value #15
Comments
type: custom:plotly-graph
entities:
- entity: sensor.openweathermap_temperature
yaxis: y1
line:
color: red
- entity: sensor.openweathermap_temperature
yaxis: y1
unit_of_measurement: W floor
mode: markers+text
texttemplate: '%{y}'
textposition: top middle
showlegend: false
marker:
color: red
textfont:
color: red
lambda: (ys) => ys.map((y,i)=> (i=== ys.length-1) && y)
hours_to_show: 24
refresh_interval: 10
Here are the default plotly colors:
More about colors here More info about texttemplate here You can do |
Oh, I found a way to force a right padding in the graph so the text fits to the right. type: custom:plotly-graph-dev
entities:
- entity: sensor.openweathermap_temperature # the lines
yaxis: y1
line:
color: '#1f77b4'
- entity: sensor.openweathermap_temperature # the text
yaxis: y1
unit_of_measurement: W floor
mode: text+markers
texttemplate: '%{y}'
textposition: middle right
showlegend: false
marker:
color: '#1f77b4'
textfont:
color: '#1f77b4'
lambda: (ys) => ys.map((y,i)=> (i=== ys.length-1) && y)
- entity: sensor.openweathermap_temperature # the invisible marker to make space for the text
yaxis: y1
mode: markers
showlegend: false
marker:
opacity: 0
size: 50
lambda: (ys, xs) => ys.map((y,i)=> (i=== ys.length-1) && y)
hours_to_show: 24
refresh_interval: 10
|
Absolutely amazing! |
It's a bit convoluted, but it seems to work fine :) I added this example in the discussions, including the legend grouping thing from the link you sent. You will probably want to use that one instead. |
BTW: I'd really appreciate it if you would make a post in https://github.com/dbuezas/lovelace-plotly-graph-card/discussions/categories/show-and-tell with some of your plots (yaml+screenshot) so others can use it as an example. You seem to be keen on getting to the advanced stuff :) |
I need some more help here. 😄 The space disappears when I press a rangeselector button. I have succeeded by manually forcing "range" to 2 hours more than the time I want to show. I normally show 12 hours. . |
@markuska00: |
Is it possible to end the graph line with a marker and current value?
Like this:
Info here:
https://stackoverflow.com/questions/66190574/plotly-how-to-annotate-end-of-multiple-lines-with-text-and-marker-colors-that-m
The text was updated successfully, but these errors were encountered: