asley
asley

Reputation: 53

Google charts issue showing only 1 option

I am able to see only one option ['Pend'] but ['Attend'] option is not showing from the chart, what is the issue from my code:

google.charts.load('current', {'packages':['corechart']});  
google.charts.setOnLoadCallback(drawChart);  
function drawChart() {  
    var data = google.visualization.arrayToDataTable([  
        ['Pend', 'Attended'],  
        <?php  
        while($row = mysqli_fetch_array($result))  
        {  
             echo "['".$row['Pend']."', '".$row['Attended']."'],";  
        }  
        ?>  
    ]);
}

Upvotes: 1

Views: 41

Answers (1)

WhiteHat
WhiteHat

Reputation: 61232

the second value in the array should be a number, not a string.
remove the single quotes...

change...

echo "['".$row['Pend']."', '".$row['Attended']."'],";

to...

echo "['".$row['Pend']."', ".$row['Attended']."],";  

Upvotes: 1

Related Questions