Sensor attributes to Apex chart

I want to create a bar chart on total_consumed from sensor attrubutes for each day and have no idea of how to code it.


I made some templating to try to understand the data:

{% for d in  states.sensor.ev9_daily_driving_stats.attributes %}
{% set dist = state_attr('sensor.ev9_daily_driving_stats',d).distance %}
{% set e = state_attr('sensor.ev9_daily_driving_stats',d).total_consumed%}

Thanks!