Took me a while to track this down but I'm pretty sure that the Table
visualization dies in the case of a calculated column (or perhaps just
the calculated column i'm using to remove nulls.  Anyway here's an
example.  The ImageChart works well with the same visualization.
Here's an example you can post in the Code Playground.

<!--
  copyright (c) 2009 Google inc.

  You are free to copy and use this sample.
  License can be found here: http://code.google.com/apis/ajaxsearch/faq/#license
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
    <title>
      Google Visualization API Sample
    </title>
    <script type="text/javascript" src="http://www.google.com/jsapi";></
script>
    <script type="text/javascript">
      google.load('visualization', '1', {packages: ['imagelinechart',
'table']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Create and populate the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Name');
        data.addColumn('number', 'Height');
        data.addColumn('number', 'age');
        data.addRows(5);
        data.setCell(0, 0, 'Tong Ning mu');
        data.setCell(1, 0, 'Huang Ang fa');
        data.setCell(2, 0, 'Teng nu');
        data.setCell(3, 0, 'Teng nu');
        data.setCell(4, 0, 'Teng nu');
        data.setCell(0, 1, 174);
        data.setCell(1, 1, 523);
        //data.setCell(2, 1, 86);
        data.setCell(3, 1, 234);
        data.setCell(4, 1, 23);
        data.setCell(1,2,23);
          data.setCell(1,2,2);
          data.setCell(2,2,3);
          //data.setCell(3,2,2);
          data.setCell(4,2,32);

        function myFunc(dv, rn) {
          var val =  dv.getValue(rn, 1);
          if(val == null) {
            return 0;
          } else {
            return val;
          }
        }

        var vis = new google.visualization.DataView(data);
        vis.setColumns([0,{calc:myFunc, type:'number'}]);

        // Create and draw the visualization.
        new google.visualization.ImageLineChart(document.getElementById
('visualization')).
            draw(vis, null);
          new google.visualization.Table(document.getElementById
('table')).
            draw(vis, null);
      }


      google.setOnLoadCallback(drawVisualization);
    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">
    <div id="visualization" style="width: 300px; height: 300px;"></
div>
    <div id='table'></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