【发布时间】:2018-01-11 11:48:45
【问题描述】:
我使用谷歌服务创建了一个饼图。问题是我想在饼图中显示贷方和借方,但输出只有一种颜色。这是我的查询。
$data = mysqli_query($link, "select SUM(pay_payable) as debit, SUM(pay_paid) as credit from purchasers_payment where p_id = '$pur_id'");
这是我的图表设置。
var data = google.visualization.arrayToDataTable([
['Debit', 'Credit'],
<?php
while($row = mysqli_fetch_array($data))
{
echo "['".$row['debit']."',".$row['credit']."],";
}
?>
]);
var options = {
is3D: true,
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
这是我的代码输出 enter image description here
我想要这样的输出: enter image description here
【问题讨论】:
标签: charts google-visualization