I am trying to create a proof of concept implementation to evaluate
the decision of Google Visualization API. I have written this sample
code but it is not rendering the barchat.

<html>
  <head>
    <script type="text/javascript" src="http://www.google.com/jsapi";></
script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["table, barchart,
areachart"]});
      google.setOnLoadCallback(initialize);

        function initialize() {
        alert ("alert called");
        drawTable
({"reqId":"3","sig":"5982206968295329967","status":"ok","table":
{"cols":[{"id":"user","label":"User","number":"string"},
{"id":"title","label":"Title","number":"string"},
{"id":"application","label":"Application","number":"string"},
{"id":"duration","label":"Duration","number":"number"}],"rows":[{"c":
[{"f":"string","v":"PKDEV168"},{"f":"string","v":"Some Title"},
{"f":"string","v":"firefox.exe"},{"f":"1","v":"45"}]},{"c":
[{"f":"string","v":"PKDEV168"},{"f":"string","v":"Some Title Part 2"},
{"f":"string","v":"chrome.exe"},
{"f":"1","v":"40"}]}]},"version":"0.5"});
        }
    function drawTable(response) {
                alert ("entered in dataTable");
//response.isError is creating ERROR - no line of code execute after
isError method is called
                if (response.isError()) {
                        alert ("in if condition - there is som error");
                        alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
                        return;
                }
                alert ("getting dataTable");
                var data = response.getDataTable();
                alert ("No.: of cols: "+ data.getNumberOfColumns());
                var table = new 
google.visualization.Table(document.getElementById
('table_div'));
                table.draw(data, {showRowNumber: false});

//              var barchart = new google.visualization.BarChart
(document.getElementById('chart_div'));
//              barchart.draw(data, {width: 600, height: 340, is3D: true,
isStacked: true, title: 'Hourly usage'});

    }
    </script>
  </head>

  <body>
    <div id="table_div"></div>
        <div id="chart_div"></div>
  </body>
</html>

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