I am using the SuperProxy API and Google Charts. I have a table with 
multiple columns and the numbers in each column should have a different 
format.
At the moment the formats are:

- Column 2: 46.354352
- Column 5: 7.34523542
- Column 6: 641.4352

While I want:
- Column 2: 46.35% (percentage)
- Column 5: 7.35 (Only 2 decimal points)
- Column 6: 10:41 (mm:ss)

I tried changing the format of one of the columns with the code below but 
nothing happens. What would be the best way to change the number format?

Thanks


<!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>
      Neon Dashboard
    </title>
    <!-- One script tag loads all the required libraries! Do not specify 
any chart types in the autoload statement. -->
    <script type="text/javascript"
        
src='https://www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1"}]}'>
    </script>
    <script type="text/javascript">
      google.setOnLoadCallback(drawVisualization);

      function drawVisualization() {
         var querd = new 
google.visualization.Query('https://my.appspot.com/query?id=gdrgssegyrthyjuyjg&format=data-table-response');
       
        querd.send(function (response) {
          var datad = response.getDataTable();

          datad.setColumnLabel(0, 'Visits');
          datad.setColumnLabel(1, 'Unique Visitors');
          datad.setColumnLabel(2, 'Bounce Rate');
          datad.setColumnLabel(3, 'Pageviews');
          datad.setColumnLabel(4, 'Pages/Visit');

          var formatter = new google.visualization.NumberFormat({
            'fractionDigits': '2',
            'pattern':'#%'
          });
          formatter.format(datad, 2);

          var Wrapperrd = new google.visualization.ChartWrapper({
            'containerId': 'd2dtable',
            'dataTable': datad,
            'chartType': 'Table',
            'options': {'width': '630px'},
            'view': {'column': [{'format': '#\'%\''}, 2]
            }
          });
          Wrapperrd.draw();
        });
     }
</script>
  </head>
  <body>
 <table align="center" style="height: 60px; width: 800px;">
      <tr valign="top">
      <tr>
        <td style='width: 80%;' align="center" align='middle'>
          <div id="d2dtable" style="height: 60px; width: 700px;" 
align='middle'></div>
        </td>
      </tr>
    </body>
</html>









-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to