the different energy series are using sensors which return null when their value is zero, and apexcharts ignores them for drawing the series when they are null
I have automation which sets the active tariff (off-peak, shoulder, peak) into an input_helper at the correct times, and I have 1 of 3 conditional cards displaying depending on which tariff is active, so it always shows the current tariff’s draw and ignores the others
(Solar panels are zero because we are in the middle of an upgrade and they are disconnected)
Looking for a little help here with an annoying (and probably easy to fix!) issue that I am having with my charts. I will paste the code below… but the problem is that the Gravity line isn’t showing the correct data and updating (I can look at another chart of that variable and it is updating properly - steadily dropping from 1.045 to current 1.039). There is also no chart line for the battery or the thermTemp… can anyone spot what is wrong with this? I’m trying to get the 2 temp sensors using the same y axis, the fridge and heaters are just boolean step charts for on/off
The naming is correct in the code below (including the batterry typo!).
I suspect a very small change could fix this, but I cant work out what!
OK, I am struggling with what I should use to even attempt to display this. As I have some experience with Apex I was thinking maybe, but I am not sure.
Goal: Displaying Pokemon Stats for the standard categories. Here’s a picture of what would be “nice” from Pokedex:
Since this data is driven in something I have built for randomly selecting a Pokemon, the data of course changes. All the values and categories are loaded into a sensor already. In fact I can display this data with a simple Markdown like this:
type: markdown
content: |-
## Stats
{% for st in state_attr("sensor.random_pokemon","stats") -%}
{{ st.stat.name }} {{ st.base_stat }}
{% endfor %}
Which looks like this:
SO I have no issues getting the name and value to plot. Apex seem though to be more of a time-based plot and not a simple one time value. I have no care about “time” as this randomly changes during the day as Pokemon are changed. There is no “history” only a single point in time and a value and that single point has names not time (i.e. 6 series … or 7 if you count the sum). Note that the sensor has many, many things only one of which is the “stats” as an attribute and those vakue are buring deeper as you can see in the Markdown template to get to the values/names. It is not a simple single attribute for each nor would I want to create more sensors based on the master sensor as the data is there.
So is Apex charts good for this? Or something else? Does anyone have a starting point for me that can help me?
You can see the discussion here about creating the original sensor:
I would also note that I am not tied to a “bar” view, maybe a circular chart is better.
Simple entities. I need those to be an attribute hanging off a sensor that needs jinja or JS to get the value and name. But maybe it is a decent stating point
Maybe I can attempt to wrap it in a custom templatable entry or? Is “series” in that case templatable is the question.
What does it need?
!) no one should assume that those stats are in the order, it should be able to be written as “for each stat” (maybe I use multiple entity card??"
2) The max should probably be like 110% greater than the largest value (maybe I use jinja custom template card?)
3) The display when mousing over the series should NOT display the percent, it should display the value (can’t believe this does not exist, I just must be missing something)
I use mutliple yaxis (2) and use 6 series. The first one uses the first yaxis and the other 5 series uses the second yaxis.
Everything fine, but if hide the first series of the five ones, the yaxis is hidden also. The reminaing 4 series don´t have a yaxis:
I expect its because the radial bar card expects values from 0-100%. This is from the Apex Charts docs:
Keep in mind that the value of these charts must be in percentage (between 0 and 100). You can still display the original value in labels, but the data presented in series must always be in a percentage.
What you really need is the bar chart I think but it isn’t currently available. Edit: here is the actual Apex Charts code that will drop the %. You will have to work out how to put it into the card syntax:
plotOptions: {
radialBar: {
dataLabels: {
total: {
show: true,
label: 'TOTAL',
formatter: function (w) {
return w.globals.seriesTotals.reduce((a, b) => {
return a + b
}, 0) / w.globals.series.length
},
},
value: {
show: true,
fontSize: '14px',
formatter: function (val) {
return val
},
},
}
}
},
@OzGav thanks for the help but I have been completely unsuccessful as I think software is calculating deeper here. The incoming values are used with “max” to determine %. “max” is required and it doesn’t seem like I can even use a EVAL: function to set “max”, it just always errors. What I would have wanted was to simply do like Math.max(w.globals.seriesTotals) to get the “max” value and set it like 10% higher. Otherwise I am relegated to setting “max” to like 250 which is greater than the maximum value of the points in all the 1008 data points, but then it isn’t as pretty as scaling it like 10% higher than the maximum for any one of them. The HA documentation states that “many” of the properties can be set using Javascript but doesn’t say which ones. I suspect “max” is one of those.
As for the “dataLabels”, no matter where I put it (apex_config or within the series itself), nothing worked. Either it errored or they did not change and remain as “%”.
Sounds like you may have hit a limit on the card’s functionality. You could try filing an issue report on GitHub and see if you can get some traction for an enhancement or wait for the ha-floorplan option and see if that works for you.
Hi,
I’m really frustrated. Half of my Apexcharts are not working anymore correctly since newest HA 2013.2 update. The problem seems that HA recorder does not save the sensor values anymore, if not changing. I have a lot of sensors which are 0 over night and not changing until morning. This results in empty ApexCharts or wrong display for area graph, for stacked …and even for line graphs. Even fill_raw is not working. Do you experience the same???
Example:
This is a sensor which 0 during night and starts producing >0 values in the morning.
As you see, there are no 0 displayed …and “Loading…” is written on the graph until first value >0 arrives
Here is the code:
type: custom:apexcharts-card
header:
show: true
title: Value - Today
show_states: false
colorize_states: false
all_series_config:
stroke_width: 2
extend_to: false
color_list:
- red
graph_span: 5h
span:
start: day
offset: +0h
series:
- entity: sensor.input_voltage
fill_raw: last
name: sensorvalue
type: line
group_by:
func: avg
duration: 1min
show:
extremas: true
If I’m changing to e.g. graph_span: 12h … you will see the mess.
So, How can I fix this problem? any help is really appreciated…