Hi, I have a problem with y-axis labels not showing correctly.
The data is stored in an influx database.
Below is the data from influx for hotwater usage per year.
2021-12-31T23:59:59+10:00 year 277.96
2022-12-31T23:59:59+10:00 year 493.5
2023-12-31T23:59:59+10:00 year 598.34
2024-12-31T23:59:59+10:00 year 760.15
2025-12-31T23:59:59+10:00 year 33.17
Epoch time:
1640959199000000000 year 277.96
1672495199000000000 year 493.5
1704031199000000000 year 598.34
1735653599000000000 year 760.15
1767189599000000000 year 33.17
Code for card:
type: custom:apexcharts-card
header:
show: true
title: Hotwater Power Usage - Yearly
show_states: false
colorize_states: true
apex_config:
chart:
height: 440
extend_to: now
xaxis:
type: datetime
labels:
show: true
rotate: 0
yaxis:
min: 0
forceNiceScale: true
stroke:
show: true
width: 1
legend:
show: true
graph_span: 10year
span:
end: year
series:
- entity: sensor.influxdb_read
type: column
float_precision: 2
name: Yearly Usage kW
group_by:
func: raw
color: '#acd373'
transform: return x / 1024;
data_generator: |
var params = new URLSearchParams({
db: "sensors",
q: "SELECT \"value\" FROM \"hotwater\" WHERE \"entity_id\" = 'year'"
});
var myInit = { method: 'GET',
headers: {
'Accept': 'application/json',
},
mode: 'cors',
cache: 'default'
};
const request = async () => {
var result = [];
const response = await fetch('http://pi5:8086/query?' + params, myInit)
const json = await response.json();
if (json["results"] && json["results"][0] && json["results"][0]["series"] && json["results"][0]["series"][0] && json["results"][0]["series"][0]["values"]) {
for(var val of json["results"][0]["series"][0]["values"]) {
result.push([new Date(val[0]), val[1]]);
}
}
return result;
}
return request();
update_interval: 5m
Which produces the below chart, however the dates on Y-Axis are wrong. 2026 has 2025 data on it. The data us correct.
If I change group_by to:
group_by:
func: last
duration: 1year
The labels on Y-Axis are correct, however some of the data is wrong. Eg: 2024 should be 760.15kw but shows 598.34kW which is what 2023 is. It also shows 598.34kW for 2023, which is correct. The time is also wrong, They should all be 31 of dec and 23:59:59.
Is there something I can do to fix this or is it a bugs ?
Thanks