I've been trying to get some Google Charts working from some data on a 
local db. I think I have got the JSON coming out properly now.

{
    "cols": [
        {
            "id": "",
            "label": "Inits",
            "pattern": "",
            "type": "string"
        },
        {
            "id": "",
            "label": "SalesVal",
            "pattern": "",
            "type": "number"
        }
    ],
    "rows": [
        {
            "c": [
                {
                    "v": "IS",
                    "f": null
                },
                {
                    "v": "1708.6000",
                    "f": null
                }
            ]
        },
        {
            "c": [
                {
                    "v": "NS",
                    "f": null
                },
                {
                    "v": "1098.8200",
                    "f": null
                }
            ]
        },
        {
            "c": [
                {
                    "v": "RC",
                    "f": null
                },
                {
                    "v": "458.8200",
                    "f": null
                }
            ]
        }
    ]
}

And I'm using this as the HTML.
<html>



  <head>

    <!--Load the AJAX API-->

    <script type="text/javascript" src="https://www.google.com/jsapi";
></script>

    <script type="text/javascript" src=
"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

    <script type="text/javascript">




    // Load the Visualization API and the piechart package.

    google.load('visualization', '1', {'packages':['corechart']});




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

    google.setOnLoadCallback(drawChart);




    function drawChart() {

      var jsonData = $.ajax({

          url: "getData.php",

          dataType:"json",

          async: false

          }).responseText;




      // Create our data table out of JSON data loaded from server.

      var data = new google.visualization.DataTable(jsonData);




      // Instantiate and draw our chart, passing in some options.

      var chart = new google.visualization.PieChart(document.getElementById(
'chart_div'));

      chart.draw(data, {width: 400, height: 240});

    }




    </script>

  </head>




  <body>

    <!--Div that will hold the pie chart-->

    <div id="chart_div"></div>

  </body>

</html>


I've gone over it a few times and can't see where I am going wrong. 
Hopefully someone can help.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Chart 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-chart-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to