It can also be done in JSP.

...
...
...
<head>

<%String table[][]=(String[][])request.getAttribute("table"); %>
<%Integer rowcount=(Integer)request.getAttribute("rowcount"); %>
<%Integer columncount=(Integer)request.getAttribute("columncount"); %>

<script type='text/javascript' src='http://www.google.com/jsapi'></
script>

<script type='text/javascript'>
    google.load('visualization', '1.0', {'packages': ['table']});
    google.setOnLoadCallback(draw);
    function draw() {
      // Create a datatable with your data.
         var data = new google.visualization.DataTable();

                //colums add
                <%
                for(int i = 0; i<columncount; i++){
                        table[0][i] = (table[0][i]==null)?"":table[0][i];
                        out.print("data.addColumn('string', 
'"+table[0][i]+"');");
                }

                %>
                //Set number of rows
                <%
                out.print("data.addRows("+rowcount+");");
                %>

                //Add rows.
                <%
                        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]+"');");
                                }
                        }

                %>
          var table = new google.visualization.Table
(document.getElementById('colorformat_div'));
          table.draw(data, {allowHtml: true, showRowNumber: true});
    }
  </script>
</head>

...
...
...
--~--~---------~--~----~------------~-------~--~----~
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