The x-axis doesn’t show a label for the first column. This is independent of the data range, so if I only pick 6 days instead of 7, the first column is still without label. Am I doing something wrong or should I report this as a bug?
I would like to change the color of the data labels to the normal text color used in the rest of the chart, e.g. for the annotation of the x-axis
I would like the data labels to not show hours in decimals, but show hours and minutes like the tooltip data does
I would like to change the tooltip data formatting to only show hours and minutes, not seconds.
The tooltip somehow seems to be offset. In the example, when I hover over the 3.9h column, it highlights that column but puts a vertical line on the 0.4h column and shows the 21m data from Aug 8 in the tooltip. Something is wrong here.
Any help is appreciated! Here is my configuration (updated):
type: custom:apexcharts-card
graph_span: 1w
span:
end: day
yaxis:
- id: tv
show: false
series:
- entity: sensor.watched_tv_today
type: column
group_by:
func: max
duration: 1d
show:
as_duration: hour
datalabels: true
yaxis_id: tv
apex_config:
grid:
show: false
dataLabels:
formatter: |
EVAL:function(value, opts) {
h = Math.floor(value);
m = Math.floor((value - h) * 60);
result = "";
if (h > 0)
result = h + "h ";
if (m > 0)
result += m + "m";
return result;
}
offsetY: -10
background:
enabled: false
style:
colors: ['var(--primary-text-color)']
tooltip:
enabled: false
New chart with updated config. I’ve disabled the tooltip but this isn’t fixed.
Another question on your code/implementation. It appears the Apex Charts omits some data compared to the standard history graph. See attached picture. The only thing I see tell visually is that the filled in areas below (when the HVAC action is ‘cooling’) appear thinner on the Apex Charts and maybe that’s why the shorter time-spans are getting cut out? Rounding error or something?
I don’t seem to be able to replicate that unfortunately. Try experimenting with the group_by: settings or remove that section altogether and see how you go.
A little question that should probably be simple but I can’t seem to figure it out – if I have a pie/donut chart with a single entity source using percentage (in this case a battery sensor), how do I get the chart to render so the pie/donut shape reflects that percentage value?
For example, below I have a battery sensor entity with 75%, and the 75% value is displayed correctly in some text places on the chart, but the pie itself always shows a complete 100% chart.
I haven’t gone in to how you would actually do this but a pie chart by design will show various values as a percentage of the total. If you only give it one value that value will always be 100% of the total no matter what the absolute reading is. I am assuming that you would have to provide two values eg, amount_full=75, amount_empty=25 or amount_empty=100 - amount_full.