Well, it appears that the dev team has changed things in the
arrayToDataTable method. If you want to input dates with that, you can do
so like this:
var data = google.visualization.arrayToDataTable([
[{label: 'Date', type: 'date'}, 'Value'],
['Date(2013, 2, 3)', 5],
['Date(2013, 2, 4)',2],
['Date(2013, 2, 5)',6],
['Date(2013, 2, 6)',7]
]);
The date string format is the same as the DataTable constructor, you just
need to specify in the header row that the column is a "date" type.
On Wednesday, April 9, 2014 6:58:18 PM UTC-4, cyb wrote:
>
> Hi,
>
> ok i think i must chance some things on the java library that it worked
> for me..
> The java library did add on the DataTable object on every Column pattern
> :"" if this pattern value is set with an empty string can i still use the
> formatType ? the documentation says that i cannot use pattern and
> formatType together..
>
> and second questions:
>
> i think it is easier to build a DataArray on server-side i have do this
> and my array looks like this:
>
> {"DataArray":[["Date","New
> York","Austin"],["Date(1975,8,6)",200,300],["Date(1980,8,6)",20,30]]}
>
> then i can use on client side var dataTable=new
> google.visualization.arrayToDataTable(data.DataArray);
>
> this works but the problem is the Date format.. if i use this directly on
> my client:
>
> data = new google.visualization.arrayToDataTable([
>> ['date','New York','Austin','San
>> Francisco','Country','Popularity'],
>> [new Date("8/6/1975"),2,3,15,'Germany',200],
>> [new Date("8/6/1980"),5,6,19,'Brazil',400],
>> [new Date("8/6/2000"),8,9,23,'United States',300],
>> [new Date("8/6/2010"),11,12,35,'RU',700]
>> ]);
>
>
> this works and it automaticly adds the type Date ans parses it to an Date
> Object.. this confuse me a little i thought the arrayToDataTable Method
> can not use Date Objects? but it seems to work..
>
> But my problem is how can in serialize the Date Object to json so that the
> arrayToDataTable Method pass this to an Date Object ?
>
>
>
>
> Am Montag, 24. März 2014 17:39:44 UTC+1 schrieb cyb:
>>
>> Hi,
>>
>> i get different data from a csv or json file. and this files must pe
>> parsed that i can use it with google charts..
>>
>> so what is the best way to do this ?
>>
>> First the CSV:
>>
>> i get different CSV files they look like this:
>>
>> date,New York,San Francisco,Austin
>> 20111001,63.4,62.7,72.2
>> 20111002,58.0,59.9,67.7
>> 20111003,53.3,59.1,69.4
>> 20111004,70.0,80.0,90.0
>>
>>
>>
>> i have used the following javascript library to convert my csv to an
>> Array that can google charts understand:
>> https://code.google.com/p/jquery-csv/
>>
>> but the problem is, this library did not work on mobile devices, i have
>> tested it on an ipad.
>> So what is the easiest an best solution for parsing a csv to the google
>> format ? the solution must run on mobile devices.
>>
>> Or are there any Frameworks that i can use on server side (java) to
>> convert a csv to a json object that google understands !? Then i can send
>> the json file to my website that google charts can read it !
>>
>> Best regards cyb
>>
>>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.