Passing config-template variable to Apexchart formatter javascript

I hope there are any clever folks who can help me out.
I am trying to manipulate the values on the X-Axis of an Apexchart. I am using the config-template-card to define a variable. See below:

type: custom:config-template-card
variables:
  offset: states['sensor.solar_sun_travel_time'].state
entities:
  - sensor.solar_sun_travel_time

I can use the variable ‘offset’ perfectly in for example the offset parameter of the Y-Axis.
But for the X-Axis I like to pass the value of the variable ‘offset’ to the javascript function ‘formatter’. Including ${offset} in the javascript function doesn’t work, also not as an argument in the function call.

Any idea how I can assign the ‘offset’ variable value to the ‘offsethours’ variable in the javascript function as shown below?

    xaxis:
      labels:
        formatter: |
          EVAL: 
            function (val) {
            var offsethours=81;
            datum = new Date(val);
            datum.setHours(datum.getHours()-offsethours );
            month = datum.toLocaleString('default', { month: 'short' });
            val = datum.getDate()+ " " + month;
            return val;
          }