Date format in MotionChart

102 views
Skip to first unread message

Prashanth

unread,
Feb 14, 2012, 2:44:58 PM2/14/12
to Google Visualization API
Hi,

I have been playing with Motion Chart [http://code.google.com/apis/
chart/interactive/docs/gallery/motionchart.html].
My setup is a web-app with Java on the server-side and bit of HTML5 on
the client with charting powered by Google Visualization API. It
worked out well for me till now.

Now I have a requirement where I have data which needs to be
visualized till the milliseconds [or at least the minutes or seconds
to be fair].
But Motion Chart takes only a JavaScript Date format for date. Was
anybody successful in customizing Motion Chart to get to at least the
minutes [as in HH:mm] instead of just the Date?

Also, I could not understand how to pass new Date(year, month, day)
from the server-side in JSON format.
I have whole bunch of data which server is sending as part of the JSON
response, but I could find the way to send the JavaScript Date object.

I am kinda stuck here since the Date format does not work out for me
and also I was not able to send back a complete Date either as
required for visualization.
Any pointers for a solution to these issues will be highly
appreciated.

Thanks and Regards,
Prashanth.

asgallant

unread,
Feb 15, 2012, 9:02:04 AM2/15/12
to google-visua...@googlegroups.com
I don't know about formatting it form ms, but to pass a date via JSON, you use a string: "Date(<parameters>)" as the value (note the absence of the keyword 'new').

Prashanth

unread,
Feb 15, 2012, 11:23:16 PM2/15/12
to Google Visualization API
Thanks a lot Asgallant.

I could resolve the issue of Date format by passing a String with
"Date(<parameters>)".
I was using new Date(<params>). Hence it was not working I guess.

Also, can you tell me how to send a Date across 2 centuries.
I mean if I give 1999 and 2010, the chart takes the start date as 10
and end date as 99.
I was not sure how to pass the year the year so that Charting API uses
all the 4 digits.
I tried lot of variants including "Date(1999, 0 ,1)" and "Date(2010,
0, 1)", but no luck.

asgallant

unread,
Feb 16, 2012, 9:57:08 AM2/16/12
to google-visua...@googlegroups.com
Date(1999, 0, 1) and Date(2010, 0, 1) work fine for me.

Prashanth

unread,
Feb 17, 2012, 9:29:02 AM2/17/12
to Google Visualization API
Got it working after I posted it.
Sorry Asgallant. I should have updated it earlier.

Thanks a lot for helping me.
Reply all
Reply to author
Forward
0 new messages