It would be best to find out what ends up in your browser.  View the source
of the page, or go to your browser's javascript console, or development
tools (in chrome) and find the source that way.

Just a guess, but it looks like your parameter values are quoted, so they
will end up as strings rather than numbers.  Try removing the quotes.

On Mon, Jan 19, 2015 at 1:10 AM, 'razgriznation23' via Google Visualization
API <[email protected]> wrote:

> Evening everyone,
>
>         I'm trying to get data from my database to display it as a pie
> chart. I have two columns of data in my database. One being an id, and the
> other being a parameter. Here is what I have so far:
>
> <html>
> <head>
> <script type="text/javascript" src="https://www.google.com/jsapi";
> ></script>
> <script type="text/javascript">
> google.load("visualization", '1.0', {packages:["corechart"]});
> google.setOnLoadCallback(drawChart);
> function drawChart() {
> var data = google.visualization.arrayToDataTable([
> ['id', 'parameter']
> <?php
> $server = 'localhost';
> $user = '';
> $pass = '';
> $db = '';
>
> $link=mysqli_connect($server, $user, $pass, $db);
> $result = mysqli_query($link, "SELECT * FROM userparameterselect")
>     or die(mysqli_error());;
> while($row = mysqli_fetch_assoc( $result )) {
>         echo ",['{$row['id']}','{$row['parameter']}']";
>     }
> ?>
> ]);
> var options = {
> title: 'Weather'
> };
> var chart = new google.visualization.PieChart(document.getElementById(
> 'chart_div'));
> chart.draw(data, options);
> }
> </script>
> </head>
> <body>
>
> <!--Div that will hold the pie chart-->
>     <div id="chart_div" style="width:400; height:300"></div>
> </body>
> </html>
>
> The title pops up, but nothing else will pop up. Any changes I should make?
>
> --
> 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/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA

-- 
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/d/optout.
  • [visualization-api] Pie ch... 'razgriznation23' via Google Visualization API
    • Re: [visualization-ap... 'Daniel LaLiberte' via Google Visualization API

Reply via email to