Apexchart offset depending on boolean

Hi
I have obviously not understood templating, or at least that is what I believe I need. I have searched and there are some similar questions, but none that involves a boolean and I cannot get it to work.

I want to offset the apexchart card one day if an attribute is false. I’ve tried following

can anyone point me in the right direction please?

type: custom:apexcharts-card
hours_12: false
header:
  show: true
  title: Elpris nordpol (öre/kWh)
  show_states: true
  colorize_states: true
now:
  show: true
  color: "#ff0000"
graph_span: 2d
all_series_config:
  stroke_width: 2
span:
  start: day
  offset: >
    {% if state_attr('sensor.current_hour_cost_full', 'tomorrow_valid') == false %}
      -0d
    {% else %}
      -1d
    {% endif %}
series:

I do not think that apexcharts supports jinja templates for options.
Supporting jinja for options is not an obvious mandatory thing for cards. If it is not explicitly described in Docs - it is not supported.
This is a proper place to ask all apexcharts-related questions, no need to create separate threads (cluttering).
Your possible option could be using cards like config-template-card - but probably more effective ways could be proposed in that dedicated thread.

1 Like

I have now installed config-template-card and changed it to the following, it works perfectly!

type: custom:config-template-card
entities:
  - sensor.current_hour_cost_full
card:
  type: custom:apexcharts-card
  hours_12: false
  header:
    show: true
    title: Elpris nordpol (öre/kWh)
    show_states: true
    colorize_states: true
  now:
    show: true
    color: "#ff0000"
  graph_span: 2d
  all_series_config:
    stroke_width: 2
  span:
    start: day
    offset: >-
      ${states['sensor.current_hour_cost_full'].attributes.tomorrow_valid ?
      '-0d' : '-1d'}
  series:

@Ildar_Gabdullin Thank you, your answer was exactly what I needed to find this!