我目前正在使用Google饼图进行数据分析,以用于名为样式表的表。
当我尝试应用Google饼图并输入查询以获取行列表时,它什么也没显示。我想获得user_type
和verification_status
的行,因此,饼图中显示的将是仅已验证或未验证的图。
这是我的php文件
<!DOCTYPE html>
<html lang="en">
<head>
<!--Chart script from google-->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['stylist_type', 'verification_status'],
<?php
$dbhandle = new mysqli("","","","");
$queryPie = "SELECT * FROM stylist";
$pieResult = $dbhandle->query($queryPie);
//I KNOW THE PROBLEM IS HERE BUT I REALLY THINK I JUST DID IT RIGHT, NEED HELP MUCH
while($row=$pieResult->fetch_assoc()){
echo "['".$row['user_type']."',".$row['verification_status']."],";
}
?>
]);
var options = {
title: 'Stylist Classifications'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Admin</title>
<link rel="icon" href="isalonlogo.png">
<!-- Bootstrap -->
<link href="css2/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div id="piechart" style="width: 900px; height: 500px;"></div>
</body>