If I leave only the offset like for Avant-hier in my example I to have the temperature from the end of day and not at the same hour 2 days before.
When I remove only data_generator (Hier) I have N/A .
My goal is to have the temperatures at the same time ( current time for Today ) for last 3 days.
type: 'custom:apexcharts-card'
apex_config:
legend:
show: false
color_list:
- red
- deepskyblue
- dimgray
graph_span: 1d
span:
start: day
header:
show: true
title: Température Ext. sur 3 jours
show_states: true
colorize_states: true
series:
- entity: sensor.0x158d000678e709_temperature
name: Aujourd'hui
extend_to_end: false
stroke_width: 4
- entity: sensor.0x158d000678e709_temperature
offset: '-1d'
stroke_width: 3
name: Hier
show:
in_header: before_now
- entity: sensor.0x158d000678e709_temperature
offset: '-2d'
name: Avant-hier
stroke_width: 2
now:
show: true
color: '#ff0000'
label: Now
Is it possible to have the min/max of the y-axis determined through some equation? What i would like is to have a fixed range (e.g. 20-24) but if the data happen to be crazy one day and exceed that, then it would rescale. So something like
Ah I see, I didn’t take into account the series with an offset defined. I’ll fix that.
That would be something like “soft” min/max. I’ll see what I can do, but ApexCharts doesn’t provide that feature natively. It’s possible though, just a bit more compute heavy
I’ve played a bit with it and have started looking into templates. I split the template yaml into a separate file and thought ‘Let’s go hunting for great examples on the web and generate a very nice set’. However, it seems like that very few have started using that feature…?
Do you know of a place where we can find some inspiration? Can we perhaps include a “templates.yaml” file in the repo?
Maybe it’s a silly question, but why after/before_now and not current as well?
I’m currently using some template trickery in combination with raw in order to get the current value.
Just wonderful, now I have the temperature as expected, thank you @RomRider !
One remarque :
I think that it’s since v1.8 ( or maybe it was like that always and I just didn’t notice ) that there is bigger space between the line NOW and the last record:
Only cosmetic issue anyway:
Not sure I understand what you are doing. The value is never exactly “now” (in milliseconds) so you have to chose if you want to display the value just before or just after now (in milliseconds) based on your use case. The chart only displays state changes and connects those state changes with a line, it has no way to know what is in between the points.
Those “before_now/after_now” are only useful if you offset series/use data_generator. Else if you don’t set any value it’s always the last value in the chart, which is usually “now”.
Plotting it gives me this chart with data both back and forward in time.
The “Now” flag is on a particular hour, but the after/before_now returns either the value before OR after the current hour… so I ended up using raw and this value_template which returns the correct value for “now”:
Strange, I was so sure that I tried before_now and it gave me the wrong result, but of cause… your right and it works. I admire your work @RomRider, thanks a ton!
You screenshot seems to be using a line, not an area. Aren’t you using some config_templates? The only way to have a transparent line like this is if the type is a line.
No, i not using any config_templates.
I try to change area with column, but remain the same, a transparent line.
i have this problem after upgrate to 1.8.0