Hello,
I have the following code that works perfectly:
type: custom:apexcharts-card
experimental:
color_threshold: true
apex_config:
plotOptions:
bar:
horizontal: false
columnWidth: 40%
dataLabels:
position: top
tooltip:
enabled: false
yaxis:
min: 0
decimalsInFloat: 0
title:
text: kWh
xaxis:
type: category
categories:
- Gen
- Feb
- Mar
- Apr
- Mag
- Giu
stroke:
show: true
width: 2
curve: smooth
chart:
height: 140%
type: bar
legend:
show: false
showForSingleSeries: true
horizontalAlign: right
position: top
dataLabels:
offsetY: 7
style:
fontSize: 11px
colors:
- "#000"
enabled: true
formatter: |
EVAL:(value) => value.toFixed(2)
background:
enabled: true
borderColor: "#fff"
borderWidth: 2
borderRadius: 2
opacity: 0.7
foreColor: "#fff"
fill:
type: gradient
gradient:
type: horizontal
shadeIntensity: 0.1
opacityFrom: 0.25
opacityTo: 1
inverseColors: true
stops:
- 0
- 90
- 100
header:
show: false
title: Consumo mensile
series:
- type: column
color: "#d10202"
show:
datalabels: true
name: Consumi
entity: sensor.consumo_lavatrice_mensile
float_precision: 2
data_generator: >
const arr = entity.state.replace(/[\[\]]/g,"").split(',').map(x =>
Number(x.trim().replace(/'/g,"")));
const categories = ["Gen","Feb","Mar","Apr","Mag","Giu"];
return arr.map((v,i) => ({ x: categories[i], y: v }));
I’d like to change into a graph line, but if I change from bar to line I don’t see anything in the card.
Why this?