Make a graph for sun duration forecast

The plugin dwd_weather ( FL550/dwd_weather: Deutscher Wetterdienst integration for Home-Assistant) creates a sensor for sunshine duration. This sensor contains the actual value and in the attributes the forecast for the next hours.

I try to create a graph showing these attribute information. During research I found out that apex chart should allow creating a graph from this information, because it can show attribute information. Therefore this information has to be mapped. I tried to create this mapping, but it didn’t result in any visible graphic. This is waht I tried:

type: custom:apexcharts-card
header:
  show: true
  title: ApexCharts-Card
  show_states: true
  colorize_states: true
series:
  - entity: sensor.wolfsburg_suedwest_sonnenscheindauer
    data_generator: | # This is what builds the data
      return entity.attributes.data.map((duration, index) => {
        return [new Date(data[index].datetime).getTime(), entity.attributes.data[index].value];
      });

Any ideas from you side on how to solve the issue?