RomRider / apexcharts-card

📈 A Lovelace card to display advanced graphs and charts based on ApexChartsJS for Home Assistant
MIT License
1.21k stars 84 forks source link

stacked: true doesn't work when using the "statistics" option. #788

Open Caleche317 opened 1 month ago

Caleche317 commented 1 month ago

Checklist

Describe the bug stacked: true doesn't work when using the "statistics" option. I can get the my bar stacked when I don't use the "statistics" option but I cannot get long term statistics. If I use the "statistics" option, I I get the long term statistics data but my bars are not stacked anymore

Version of the card Version: v2.1.2

To Reproduce With the statistics enabled :

type: custom:apexcharts-card
graph_span: 30d
stacked: true
header:
  title: Consommation électrique des 30 derniers jours
  show: true
series:
  - entity: sensor.tywatt_chauffage_ecs
    type: column
    name: Chauffage + Eau Chaude
    color: ff6f61
    statistics:
      type: change
      period: day
      align: start
    show:
      legend_value: false
  - entity: sensor.tywatt_cuisson
    type: column
    name: Cuisson
    color: ff9932
    show:
      legend_value: false
  - entity: sensor.prise_pc_energy
    type: column
    name: PC
    color: 886fff
    statistics:
      type: change
      period: day
      align: start
    group_by:
      func: diff
      duration: 1d
      start_with_last: true
    show:
      legend_value: false
  - entity: sensor.prises_non_detaillees
    type: column
    name: Autres Prises
    color: 41d1ff
    statistics:
      type: change
      period: day
      align: start
    show:
      legend_value: false
  - entity: sensor.tywatt_autres
    type: column
    name: Non surveillé
    color: aeaeae
    statistics:
      type: change
      period: day
      align: start
    show:
      legend_value: false
show:
  last_updated: true
span:
  start: day
  offset: '-29d'
apex_config:
  xaxis:
    tooltip:
      enabled: false
    labels:
      hideOverlappingLabels: true
      showDuplicates: true
      format: dd/MM

Without the statistics enabled:

type: custom:apexcharts-card
graph_span: 30d
stacked: true
header:
  title: Consommation électrique des 30 derniers jours
  show: true
series:
  - entity: sensor.tywatt_chauffage_ecs
    type: column
    name: Chauffage + Eau Chaude
    color: ff6f61
    group_by:
      func: diff
      duration: 1d
      start_with_last: true
    show:
      legend_value: false
  - entity: sensor.tywatt_cuisson
    type: column
    name: Cuisson
    color: ff9932
    group_by:
      func: diff
      duration: 1d
      start_with_last: true
    show:
      legend_value: false
  - entity: sensor.prise_pc_energy
    type: column
    name: PC
    color: 886fff
    group_by:
      func: diff
      duration: 1d
      start_with_last: true
    show:
      legend_value: false
  - entity: sensor.prises_non_detaillees
    type: column
    name: Autres Prises
    color: 41d1ff
    group_by:
      func: diff
      duration: 1d
      start_with_last: true
    show:
      legend_value: false
  - entity: sensor.tywatt_autres
    type: column
    name: Non surveillé
    color: aeaeae
    group_by:
      func: diff
      duration: 1d
      start_with_last: true
    show:
      legend_value: false
show:
  last_updated: true
span:
  start: day
  offset: '-29d'
apex_config:
  xaxis:
    tooltip:
      enabled: false
    labels:
      hideOverlappingLabels: true
      showDuplicates: true
      format: dd/MM

Screenshots With Statistics image

Without Statistics image

Expected behavior I expect the bar to stack when using the "statistics" option. Am i missing something ?

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.