Pretty much everything I can think of is a variant on what you're doing
already, so as long as that works, I'd go with it.
On Tuesday, April 24, 2012 12:35:46 PM UTC-4, Jay wrote:
>
> Hi ,
>
> Thanks for your response.
>
> I just wanted to know, is there an explicit way to pass additional
> parameter to the handler function other than the default response object.
>
> My purpose was to generate N number of charts in the same page, with the N
> requests made consecutively and each request differ from one another by few
> properties like Query, URL Parameters etc.
>
> I resolved it by the following method.
>
> <div id='chart1'></div>
> <div id='chart2'></div>
>
> var query = {};
> var queryString = {};
> var temp = null;
>
> for(var i=0;i<2;i++){
> temp = i;
> query[temp] = new google.visualization.Query(URL+temp);
> queryString[temp] = "Select Col"+temp+ " limit 20";
> query[temp].setQuery(queryString[temp]);
> (function(inIndex){
> query[inIndex].send(function(response){
> response['displayIndex'] = inIndex;
> handleResponse(response);
> });
> );
> })(temp);
> }
>
>
> function handleResponse(response){
> // pass the relevant container name to the chart instance.
> }
>
> Let me know if there is a better way than this.
>
> Thanks
>
>
>
>
>
>
> On Tuesday, April 24, 2012 7:16:29 AM UTC-7, asgallant wrote:
>>
>> I'm not sure what your purpose here is - why would you need to modify
>> anything in the response object? Or are you asking how to pass a value for
>> "myCustomVariable" to the handleResponse function?
>>
>> If the latter case is what you are after, then you can get around the
>> problem by passing the Query#send() method an anonymous function, like this:
>>
>> var myCustomVariable;
>> query.send(function (response) {
>> // this is the query response handler function
>> // use myCustomVariable in here
>> });
>>
>> On Tuesday, April 24, 2012 1:24:45 AM UTC-4, Jay wrote:
>>>
>>> Does anyone know the easiest way to set additional or custom parameters
>>> to the handler function?
>>>
>>> var query = new google.visualization.Query(URL);
>>> var queryString = "Select * limit 20";
>>> query.setQuery(queryString);
>>> query.send(handleResponse);
>>>
>>> function handleResponse(response){
>>> // response[myCustomVariable] #how to set this variable?
>>> }
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/2M1czkfgVAYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.