0👍
So, if anyone ever stumbles upon the same need and is using Django, here is the easiest method I finally devised : I created a custom tag to offset my x value (which is a datetime) by half of the timestep of my dataset.
In customtags.py:
def add_minutes(utc_datetime, minutes):
time = datetime.datetime.strptime(utc_datetime, "%Y-%m-%dT%H:%M:%SZ") + datetime.timedelta(minutes=minutes)
return time.strftime("%Y-%m-%dT%H:%M:%SZ")
In my template (remember that my timestep is 20 minutes):
data: [{% for begin_time, data in myvalues.items %}{x: "{{begin_time | add_minutes:10}}", y: {{data | length}}},{% endfor %}],
Works like charm.
Cheers !
Source:stackexchange.com