Hi!

There are actually three ways I see to tackle this problem..

1. What you said, have the page created with javascript code with many
dataTable.setCell()s
2. Have the page created with javascript code creating a datatable from
JSON. See references and examples in :
http://code.google.com/apis/visualization/documentation/reference.html#dataparam
3. Implement a datasource, as defined in
http://code.google.com/apis/visualization/documentation/dev/implementing_data_source.html

If you indeed choose option 3, I'm afraid you will indeed need to handle all
the reqId and other things defined here:
http://code.google.com/apis/visualization/documentation/dev/implementing_data_source.html
But you might choose to go with option 2, which is slightly simpler to
implement. One disadvantage of this, is that users won't be able to
configure other visualizations (or gadgets) based on your data.

Option 1 is probably not for you. If you have automated code generation,
usually option 2 is better. But if you like option 1, it's fine too :)

Regards,
VizGuy


On Mon, Feb 9, 2009 at 2:10 PM, MartinOShea <[email protected]> wrote:

>
> Hello
>
> I'm a 'newbie' with the Google Visualization API but I wonder if
> anyone can advise with an issue I have?
>
> I'm working on a system where users will be able to generate various
> visualisations from various datasets created from tables they upload.
> And I want to use the Google Visualization API to create the
> visualisations, i.e. bar charts, word clouds etc.
>
> My application uses Java servlets and JSPs with a MySQL back-end
> database. Now, as I see it, there are two ways for me to return data
> from the database for use in the Google Visualization API Javascript:
>
> The first is to read the data into a 2D-array on the server and pass
> this to a JSP and construct the Javascript like this:
>
> <%
>                        for(int i = 1; i < rowcount; i++){
>
>
>                                for(int j = 0; j<columncount; j++){
>                                        table[i][j] = (table[i][j]
> ==null)?"":table[i][j];
>                                        out.print("data.setCell("+
> (i-1)+", "+j+", '"+table[i][j]+"');");
>                                }
>                        }
>
>
>                %>
>
> Or I can use my preference which is to use Google Visualization URLs
> with JSON of the type:
>
> var query = new google.visualization.Query(http://www.example.com/
> mydatasource)
>
> However, is it necessary to specify the reqID and sig fields at all?
>
> Also, am I right in thinking that the reponse to this can be
> constructed dynamically as a string containing the data in a servlet?
>
> And that some encoding or decoding of URLs might be needed?
>
> Thanks
>
> Martin O'Shea.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to