Datetime error

1,174 views
Skip to first unread message

NA

unread,
Jun 2, 2011, 2:53:53 PM6/2/11
to Google Visualization API
Hi,

I get the error below when using datetimes. Any idea what causes
this?

Uncaught Error: Type mismatch. Value Date(2011,5,1,14,0,0) does not
match type datetime in column index 0

This should be a valid datetime. In fact, I have been using Date
objects like this and haven't seen this error before. It only happens
when my script for producing charts is called from within another
website. When the script is called directly, there is no error.

Any ideas?

NA

unread,
Jun 4, 2011, 12:19:18 PM6/4/11
to Google Visualization API
FWIW, my workaround is:

function MassageTable(dataTable,ColumnIDMap) {
var dateCol = ColumnIDMap['timebin']; // your date column id should
be defined here
for (var i=0;i<dataTable.getNumberOfRows();i++) {
dateVal = dataTable.getValue(i,dateCol);
// If it's already a date, do nothing
if (dateVal instanceof Date) {continue;}
evalStr = 'new ' + dateVal;
newDate = eval(evalStr);
dataTable.setValue(i,dateCol,newDate);
}
return dataTable;

MC Get Vizzy

unread,
Jun 5, 2011, 10:18:08 AM6/5/11
to google-visua...@googlegroups.com
How does your script get called from other websites?

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


NA

unread,
Jun 5, 2011, 11:20:40 AM6/5/11
to Google Visualization API
I print the result of PHP's file_get_contents. Specifically, I have:

- Google Chart Javascript lives on http://serverA.com
- Web page on http://serverB.com contains the code: <?php echo
file_get_contents('http://serverA.com'); ?>

Viewing the page directly by visiting serverA works perfectly. But
when I view the page on serverB, I consistently get this error.

I assume it's something to do with the cross server call, but I don't
understand what about the request would cause this.

MC Get Vizzy

unread,
Jun 6, 2011, 6:13:49 AM6/6/11
to google-visua...@googlegroups.com
Yes, you're right, it seems to be related to the cross-domain issue.  google.visualization.Query acts differently for cross-domain queries.  Since the response is JSONP and not real JSON, it does not convert the JSON date strings into Date objects.  This behavior is indeed problematic, so I'll see if it can be fixed.

thanks,

MC Get Vizzy

NA

unread,
Jun 6, 2011, 10:55:20 AM6/6/11
to Google Visualization API
Awesome, ty. I'm new at this, and it's very relieving to get
confirmation that it wasn't a problem in my code. My workaround is
fine for now, but if this is fixed in the underlying code that'd be
great.

thanks,



On Jun 6, 6:13 am, MC Get Vizzy <getvi...@google.com> wrote:
> Yes, you're right, it seems to be related to the cross-domain issue.
>  google.visualization.Query acts differently for cross-domain queries.
>  Since the response is JSONP and not real JSON, it does not convert the JSON
> date strings into Date objects.  This behavior is indeed problematic, so
> I'll see if it can be fixed.
>
> thanks,
>
> MC Get Vizzy
>
>
>
>
>
>
>
> On Sun, Jun 5, 2011 at 6:20 PM, NA <nabeel.a...@gmail.com> wrote:
> > I print the result of PHP's file_get_contents.  Specifically, I have:
>
> > - Google Chart Javascript  lives onhttp://serverA.com
> > - Web page onhttp://serverB.comcontains the code:  <?php echo

NA

unread,
Jul 15, 2011, 2:59:08 PM7/15/11
to Google Visualization API
Was this corrected in the latest release? I'd love to simplify my
MassageData() method to no longer have to worry about this.

MC Get Vizzy

unread,
Jul 18, 2011, 10:16:11 AM7/18/11
to google-visua...@googlegroups.com
Unfortunately, this has not been fixed yet.

On Fri, Jul 15, 2011 at 9:59 PM, NA <nabee...@gmail.com> wrote:
Was this corrected in the latest release?  I'd love to simplify my
MassageData() method to no longer have to worry about this.

--

NA

unread,
Aug 17, 2011, 10:24:25 AM8/17/11
to Google Visualization API
Do we have an ETA on this? It adds an extra set of processing I have
to do on every data set, which I'd love to eliminate.

MC Get Vizzy

unread,
Aug 21, 2011, 11:31:10 AM8/21/11
to google-visua...@googlegroups.com
No ETA right now, sorry.  We'll try to address it soon.

On Wed, Aug 17, 2011 at 5:24 PM, NA <nabee...@gmail.com> wrote:
Do we have an ETA on this?  It adds an extra set of processing I have
to do on every data set, which I'd love to eliminate.

--

MC Get Vizzy

unread,
Jan 31, 2012, 3:13:33 AM1/31/12
to google-visua...@googlegroups.com
I think this is fixed now.  Can you try skipping the processing and seeing if it works?
Reply all
Reply to author
Forward
0 new messages