That's not how you're supposed to use the query. You can find more
information about it's use
here<https://developers.google.com/chart/interactive/docs/queries#Sending_a_Query>,
but I'll try to give you the basics. We don't currently support converting
a CSV string into a DataTable, only requesting a CSV file over the network.
So it is assumed that you have a URL to your CSV file stored in a variable,
call it csvUrl. That means that we would do something like the following:
var queryOptions = {
csvColumns: ['number', 'number' /* Or whatever the columns in the
CSV file are */],
csvHasHeader: true /* This should be false if your CSV file doesn't
have a header */
}
var query = new google.visualization.Query(csvUrl, queryOptions);
query.send(handleQueryResponse);
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
var data = response.getDataTable();
// Draw your chart with the data table here.
}
- Sergey
On Tue, Dec 10, 2013 at 1:54 PM, Raimiui Tam <[email protected]> wrote:
> Thank you for answer !
>
> When I try set "var data = google.visualization.Query.response(csv1,
> 'csvColumns', 'csvHasHeader');" I get :
>
> Uncaught TypeError: Object function yu(a,b){var
> c=b||{};this.Fja=ri(c.csvColumns);this.mTa=c.csvColumns;this.XT=!!c.csvHasHeader;this.i4=c.sendMethod||qg;this.BIa=!!c.xhrWithCredentials;if(!ak(zu,this.i4))throw
> l("Send method not supported:
> "+this.i4);this.xja=c.makeRequestParams_||{};ru(a)?a=this.DTa(a):qu(a)&&(a=this.ETa(a));var
> d=a,c=qu(d),d=jn(kn(5,d)),d=ou[bd](d);(c=c&&d)||(d=a,c=ru(d),d=jn(kn(5,d)),d=ou[bd](d),c=c&&d);this.AIa=c;this.zIa=a;this.z3=kfa++;Au[z](this)}
> has no method 'response'
> any ideas?
>
> Thanks!
> Raimundas
>
>
> 2013 m. gruodis 9 d., pirmadienis 22:31:50 UTC+2, Sergey rašė:
>>
>> Hi, we will be updating our documentation soon, for now, I can fill you
>> in. The dataTableFromCsv support is built into our Query object. Namely, we
>> expose two new options: 'csvColumns' (which should be an array of column
>> types), and 'csvHasHeader' (which determines whether the first row of the
>> CSV should be interpreted as a header row). The file will be interpreted as
>> CSV if you specify the csvColumns option, so it should be fairly
>> straightforward. One thing to keep in mind is that you can only load CSV
>> files that are on the same domain as your chart.
>>
>> Good luck!
>>
>> - Sergey
>>
>>
>> On Mon, Dec 9, 2013 at 2:16 PM, Raimiui Tam <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> In November 26, 2013 release notes I see "Support dataTableFromCsv".
>>> Where i can find more info about it?
>>>
>>> --
>>> 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/groups/opt_out.
>>>
>>
>> --
> 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/groups/opt_out.
>
--
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/groups/opt_out.