in django I am creating data series using datetime.date() objects, like this:
data.append([ddate, daily_score]) (ddate is a datetime.date() object, daily_score is integer)
How can I format them in the jquery flot diagram in the following way?
“Day/Month”?
I am doing this:
xaxis:{
mode: 'time',
timeformat: '%d/%m',
minTickSize: [1, "day"]
},
but I get no graph to display.
If you read the flot documentation, you will see that the time format is supposed to be a Javascript timestamp, that is, milliseconds since epoch (January 1 1970 00:00:00 UTC). You pass a
datetimeobject, so I guess that’s your problem.You can easily convert your dates to milliseconds since epoch though:
After I wrote this suggestion I saw that the flot documentation also had a suggestion of how to do in python:
Otherwise your syntax looks ok from what I can tell.