To your first question, the problem is that you can't pass the JSON to the DataView constructor, you have to create a DataTable object first, and then pass the DataTable to the DataView constructor:
var data= new google.visualization.DataTable(json); var dataView = new google.visualization.DataView(data); To create a date column server-side, you need to follow a similar approach as I outlined in your other thread (split the string into year, month, day, subtract 1 from month to make it compatible with javascript's date objects). Instead of creating a date object (which are not suported by JSON), you need to create a date string like this: "Date(year, month, day)" It is almost exactly the same as what you would do in javascript, except it is a string, and there is no "new" keyword used. The Visualization API will parse that string as a date if the data type of the column is set to "date". On Monday, April 7, 2014 8:10:23 PM UTC-4, cyb wrote: > > Hi, > > ok i have found my mistake.. > > i must use the JsonRenderer "JsonRenderer.renderDataTable(data, true, > true, true)" and then i can use on the Client side "var data= new > google.visualization.DataTable(json)". > > But how can i parse a csv on the server side to a DataTable ? i have the > following csv: > > 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 >> > > and if the dataTable is created on server side can i change then the date > Colum to a 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.
