RomRider / apexcharts-card

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

Not able to retrieve statistics data #760

Open rp2019433 opened 3 weeks ago

rp2019433 commented 3 weeks ago

Checklist

Describe the bug There is an entity sensor.consumo_energia_diario_kwh. It contains long term statistics for August 11 and 12 and historic data from August 13 onwards.

image

For the code below, graph is generated correctly but without LTS data:

type: custom:apexcharts-card
graph_span: 15d
span:
  end: day
apex_config:
  chart:
    height: 150px
experimental:
  color_threshold: true
show:
  last_updated: false
header:
  show: true
  show_states: true
  colorize_states: true
  title: Consumo Diário de Energia
yaxis:
  - min: 0
    max: auto
    decimals: 2
    apex_config:
      tickAmount: 5
      title:
        text: kWh
series:
  - entity: sensor.consumo_energia_diario_kwh
    group_by:
      func: max
      duration: 1d
    show:
      header_color_threshold: true
      extremas: false
      datalabels: false
    color: '#3170EE'
    type: column
    float_precision: 2
    name: Consumo por mês

image

When I add to the code statistics parameter, graph gets stuck in "loading" and is not generated:

series:
  - entity: sensor.consumo_energia_diario_kwh
    statistics:
      type: max
      period: day
    group_by:
      func: max
      duration: 1d
    show:
      header_color_threshold: true
      extremas: false
      datalabels: false
    color: '#3170EE'
    type: column
    float_precision: 2
    name: Consumo por mês

image

Version of the card Version: v2.1.2

To Reproduce Configuration posted above.

Screenshots Screenshots posted above.

Expected behavior It was supposed to graph be generated with LTS and historical statistics.

Desktop (please complete the following information):

rp2019433 commented 3 weeks ago

Home Assistant information:

Core 2024.8.2 Supervisor 2024.08.0 Operating System 13.0 Frontend 20240809.0