Hello All,
I am having this weird issue where I cannot just get around. I need to
convert massive amount of data to json to plot on timeline charts. I
found givz_api (http://code.google.com/apis/chart/interactive/docs/dev/
gviz_api_lib.html#populatedata) which could do that for me. I have
tested it with strings and numbers and it works great. However it wont
work with datetime. Here is my code:
----------------------------------------------------------------------------------------------
#!/usr/bin/env python2.6
# -*- coding: UTF-8 -*-
import cgi, cgitb, gviz_api
cgitb.enable()
def main():
description = {"data_time": ('datetime', 'Date/Time'),
"open": ('number', 'Open'),
"active": ('number', 'Active'),
"ua": ('number', 'U/A'),
"fr": ('number', 'F/R'),
"fourhr": ("number", "4hr+")}
data = [{'data_time': (2012, 02, 14, 15, 00, 00),
'open': 156,
'active': 128,
'ua': 16,
'fr': 25,
'fourhr': 32}]
data_table = gviz_api.DataTable(description)
data_table.LoadData(data)
print "Content-type: text/plain"
print
print data_table.ToJSonResponse(columns_order=("data_time", "open",
"active", "ua", "fr", "fourhr"))
if __name__ == '__main__':
main()
------------------------------------------------------------------------------------
When I run this, this is what I get:
DataTableException: Wrong format for value and formatting - (2012, 2,
14, 15, 0, 0).
I cannot make it work. Anybody can give me some hints? I am totally
stuck.
Thanks,
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.