I think this is related to how apexcharts treats a datetime axis (ignoring tickamount etc) so not sure Romrider can do anything about that. @lcsiew I think you were on the right track by switching to a category axis. You seem to be missing a block scalar after formatter: you need to add a > or a |
I am trying to modify graph_span and duration using helpers. I continue to get an error saying that its not a valid range of time. When I test the helpers in template the output is correct.
You cannot use templates on these elements out of the box, you will need to wrap the apex card in something like config-template-card or use a conditional card as explained by @Mariusthvdb who included an example of what you are trying to achieve
I was hoping someone could help me on something Im trying to achieve:
I have multiple sensors, (all following the naming pattern sensor.*_xyz), which have a numeric state and an attribute named 'color', it being a color in the format #001122.
I am trying to create a pie chart with apexCharts and auto-entities (up to this I have managed), but I would like each element to take the color based on the attribute ‘color’.
So far, this is what I have put together, not managing to introduce the color part:
The documentation lists yAxisIndex as the property that deals with that but I did not manage to make that work (I wanted to do a point annotation on a series on a secondary y-axis). In another case I ended up calculating the value of the first axis that was needed to make it look good on the axis the annotation belonged to but that only works when you have full control over both axis.
The series are drawn in order they appear in the series config so you can overlay one fill on top of another.
By setting the fill of a lower series to the same colour as your background colour you can mask off a series above it. It’s not perfect. It will cover everything, including the graph axis lines.
Series config for graph above. The 90% to 10% shading is produced by the 2nd and 3rd series.
series:
- entity: sensor.todays_solar_forecast
name: Forecast
color: "#e0b400"
type: line
stroke_width: 2
show:
datalabels: false
- entity: sensor.todays_solar_forecast_90
name: 90% Probability
color: "#e0b400"
opacity: 0.3
type: area
stroke_width: 0
show:
in_legend: false
- entity: sensor.todays_solar_forecast_10
name: 10% Probability
color: var(--card-background-color)
opacity: 1
type: area
stroke_width: 0
show:
in_legend: false
- entity: sensor.solar_production_energy
name: Actual
color: "#0da035"
type: line
stroke_width: 2
statistics:
type: state
period: day
align: middle
without reading through the whole topic can someone point me in the direction of defining a time scale on x axis if its possible e.g for 24 hours theres a 2h spacing on x axis. thanks!
Not exactly, the following fills till whatever value is at the end of your chart
plotOptions:
area:
fillTo: end
You can bring those back with
Grid:
Position: Front
And for perfect blending into the background, the default shade of white in HA is #FAFAFA
You can do a lot of cool things with overlaying area series but looking at the code of OP - and if only a block range is needed - you can also add a second y-value to annotations and make it a range instead of a line
As you say, it fills to the bottom, ignoring the xaxis, the alternative is filling till the xaxis (from the top and the bottom). You can indeed not do a range area but the overlaying you described works well, I’ve also combined it with color thresholds to show fill colors changing when crossing the xaxis
Yes, I saw that in your code, that’s even better, but I was referring to the default background color in HA. I saw a different shade of white inside and outside the plotted area, sure that was intentional but some might wonder why and want it to be the same white to blend into the background, if so you can use
Then I split the second entity into 2, one for the colored line and a second time for the filled area, but that looked anything but the card background color.
Hello, please can someone help me with writing a transform/generate (?) function to take a value that is sampled every 10 minutes and make a chart of hourly averages over the same day of week? Like average number of samples at 11:00am for Monday is … etc.
I guess I should use data_generator but I have no idea how to process the series of historical entries.
Thank you in advance.
Update:
One idea was to retrieve the statistics via recorder.get_statistics call, then it could be filtered and transformed via transform function. But ApexCharts card does not support calling actions hence this is apparently a no go.