Re: [visualization-api] Google Charts addRows not accepting Dates when passed via parsed String

2016-11-02 Thread Vincent Holland-Keen
Thanks for the suggestion. For the time being I've just passed the required 
rows into the DataTable initialisation. That doesn't allow me to add rows 
en masse later, but covered most of the situations I needed to handle. 
Unfortunately, I've since had to move on to other work, so haven't got time 
to back to this at the moment, but if the opportunity arises, I'll try the 
workaround above. 

On Thursday, October 13, 2016 at 4:46:55 PM UTC+1, Daniel LaLiberte wrote:
>
> Hi Vincent,
>
> We have tried to unify the various ways of setting up DataTables, but 
> there have been changes in how dates are handled recently, and it appears 
> likely the case you found has been either broken, or always was broken.
>
> Can you can use new Data(...) without quotes?  JSON notation doesn't allow 
> new Date() constructors, so that is why the "Date(...)" format is supported 
> at least there.  When you use JSON.parse() you are just turning the string 
> into an anonymous JS object, so if you can use the anonymous JS object 
> instead, with new Date() constructors, that would be the simplest 
> workaround.
>
> On Mon, Oct 10, 2016 at 6:10 AM, Vincent Holland-Keen  > wrote:
>
>> Hi,
>>
>> I've been struggling for days to get dates working with a chart and have 
>> finally come to the (possibly erroneous) conclusion that there's a 
>> difference between the implementation of dates in the DataTable function 
>> and in the addRows function.
>>
>> This JSFiddle hopefully shows what I mean: 
>> https://jsfiddle.net/fiskerton/vc4o0710/1/
>>
>> If a DataTable is created with both columns and rows, passing in a 
>> JSON.parse'd string with a date value in the format 'Date(,MM,DD)' 
>> works fine. If that same format is passed to addRows, the console throws 
>> the error: 'Uncaught Error: Type mismatch. Value Date(,MM,DD) does not 
>> match type date in column index 1. I haven't found any other format that 
>> successfully takes a string containing a date and gets it to work with 
>> addRows - e.g. 'new Date(,MM,DD' fails with same error.
>>
>> Is there something I've missed?
>>
>> Thanks.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google Visualization API" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-visualization-api+unsubscr...@googlegroups.com 
>> .
>> To post to this group, send email to google-visua...@googlegroups.com 
>> .
>> Visit this group at 
>> https://groups.google.com/group/google-visualization-api.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-visualization-api/6294cb99-9812-471b-87fc-7b040a6972c2%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Daniel LaLiberte 
> dlali...@google.com5CC, Cambridge MA
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/16749bb4-8e26-464b-9b5f-a56cda7d4b6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [visualization-api] Google Charts addRows not accepting Dates when passed via parsed String

2016-10-13 Thread 'Daniel LaLiberte' via Google Visualization API
Hi Vincent,

We have tried to unify the various ways of setting up DataTables, but there
have been changes in how dates are handled recently, and it appears likely
the case you found has been either broken, or always was broken.

Can you can use new Data(...) without quotes?  JSON notation doesn't allow
new Date() constructors, so that is why the "Date(...)" format is supported
at least there.  When you use JSON.parse() you are just turning the string
into an anonymous JS object, so if you can use the anonymous JS object
instead, with new Date() constructors, that would be the simplest
workaround.

On Mon, Oct 10, 2016 at 6:10 AM, Vincent Holland-Keen <
vincent.hk...@gmail.com> wrote:

> Hi,
>
> I've been struggling for days to get dates working with a chart and have
> finally come to the (possibly erroneous) conclusion that there's a
> difference between the implementation of dates in the DataTable function
> and in the addRows function.
>
> This JSFiddle hopefully shows what I mean: https://jsfiddle.net/
> fiskerton/vc4o0710/1/
>
> If a DataTable is created with both columns and rows, passing in a
> JSON.parse'd string with a date value in the format 'Date(,MM,DD)'
> works fine. If that same format is passed to addRows, the console throws
> the error: 'Uncaught Error: Type mismatch. Value Date(,MM,DD) does not
> match type date in column index 1. I haven't found any other format that
> successfully takes a string containing a date and gets it to work with
> addRows - e.g. 'new Date(,MM,DD' fails with same error.
>
> Is there something I've missed?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-visualization-api+unsubscr...@googlegroups.com.
> To post to this group, send email to google-visualization-api@
> googlegroups.com.
> Visit this group at https://groups.google.com/
> group/google-visualization-api.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-visualization-api/6294cb99-9812-471b-87fc-
> 7b040a6972c2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte 
dlalibe...@google.com    5CC, Cambridge MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPwbaFF2cjPdqWefrdn7FFfbYFHSTp%3DQZMHa%2Bx7hGNr3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.