Hello, I write down this code, but the label doesn’t stay at the top,it stays in center:
type: custom:apexcharts-card
apex_config:
plotOptions:
bar:
horizontal: false
columnWidth: 50%
yaxis:
min: 0
xaxis:
type: category
categories:
- Dic-Gen
- Feb-Mar
- Apr-Mag
- Giu-Lug
- Ago-Set
- Ott-Nov
stroke:
show: true
width: 2
curve: smooth
chart:
height: 140%
type: bar
legend:
show: false
showForSingleSeries: true
horizontalAlign: right
position: top
dataLabels:
offsetY: 0
position: top
style:
fontSize: 12px
colors:
- "#000"
enabled: true
background:
enabled: true
borderColor: "#fff"
borderWidth: 2
borderRadius: 2
opacity: 0.4
foreColor: "#ccccff"
dropShadow:
enabled: true
top: 2
left: 2
blur: 1
color: "#000000"
opacity: 0.5
fill:
type: gradient
gradient:
type: horizontal
shadeIntensity: 0.1
opacityFrom: 0.25
opacityTo: 1
inverseColors: true
stops:
- 0
- 90
- 100
header:
show: true
title: Consumo bimestrale (kWh)
series:
- type: column
color: blue
show:
datalabels: true
name: Consumi
entity: sensor.consumo_bimestrale_serie
data_generator: >
const arr = entity.state.replace(/[\[\]]/g,"").split(',').map(x =>
Number(x.trim()));
const categories =
["Dic-Gen","Feb-Mar","Apr-Mag","Giu-Lug","Ago-Set","Ott-Nov"];
return arr.map((v,i) => ({ x: categories[i], y: v }));
Iìd like that the label could always be on top of the bars, indipendently from the height of the bars.