Using variables in apex-chart

When I try to create at var in apex charts I get “var is extraneous”

type: custom:apexcharts-card
header:
  title: Dynamic Chart
  show: true
var: # Define variables here
  span: input_select.observerhours # 

What am I missing

There is no var option in the docs.

I am using similar but with the config-template-card which add templating capability

type: custom:config-template-card
card:
  type: custom:apexcharts-card
  graph_span: 30h
  header:
    show: true
    title: Verbruik gedurende de dag
    show_states: true
    colorize_states: true
  series:
    - entity: sensor.linky_hphc_daily
      name: total
      curve: smooth
      color: '#df6366'
      offset: ${'-' + states['input_number.offset_days'].state +'d'}
      type: column
      opacity: 0.6
      stroke_width: 1
      statistics:
        type: state
    - entity: sensor.linky_hphc_daily
      curve: smooth
      offset: ${'-' + states['input_number.offset_days_2'].state +'d'}
      color: green
      type: column
      opacity: 0.1
      stroke_width: 0.2
      statistics:
        type: state
entities:
  - input_number.offset_days_2
  - input_number.offset_days
1 Like

And your graph is not updated realtime since you have not declared sensors as monitored by CTC.