I like the simplicity of the pie chart example on the google charts page 
using data that is manually input.  I would like to replace this "hard 
coded" data by bringing in data from a google spreadsheet via tabletop.js. 
I know how to install tabletop.js and google charts.  I am just not sure 
how to code the function in javascript to bring in the data to make the pie 
chart dynamic.  The hard coded version looks like this: 
If you can help, it's appreciated.

    <!--Load the AJAX API-->
    <script type="text/javascript" 
    <script type="text/javascript">

      // Load the Visualization API and the corechart package.
      google.charts.load('current', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

        // Create the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Slices');
          ['Mushrooms', 3],
          ['Onions', 1],
          ['Olives', 1],
          ['Zucchini', 1],
          ['Pepperoni', 2]

        // Set chart options
        var options = {'title':'How Much Pizza I Ate Last Night',

        // Instantiate and draw our chart, passing in some options.
        var chart = new 
        chart.draw(data, options);

    <!--Div that will hold the pie chart-->
    <div id="chart_div"></div>

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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to