这就是我想要做的。
我有供应商从那里购买潜在客户,我需要查看系统中所有可计费潜在客户的比较,以了解哪些供应商正在执行,哪些没有执行。Q 表示可计费的潜在客户。使用我当前的代码,我得到了我的图表,它在图例中列出了所有供应商,但每个供应商的可计费 (Q) 金额显示每个供应商的所有供应商的所有可计费 (Q) 潜在客户的总金额。我很确定我需要 $rowcount=mysqli_num_rows($result); 在里面的某个地方 while($row = mysqli_fetch_array($result)) { 我只是想不通,我已经阅读了我能读到的所有内容。如果有人知道如何解决这个问题,请帮忙。谢谢我正在使用 CanvasJS 和 PHP
<head>
<script type="text/javascript">
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Top Oil Reserves"
},
axisY: {
title: "Reserves(MMbbl)"
},
legend: {
verticalAlign: "bottom",
horizontalAlign: "center"
},
theme: "theme1",
data: [
{
type: "column",
showInLegend: true,
legendMarkerColor: "grey",
legendText: "MMbbl = one million barrels",
dataPoints: [
<?php
include 'include/dbconnect.php';
$result = mysqli_query($con,"SELECT * FROM EduCampaign1 WHERE leadstatus='Q'");
$rowcount=mysqli_num_rows($result);
while($row = mysqli_fetch_array($result)) {
?>
{y:<?php echo $rowcount; ?>, label: "<?php echo( htmlspecialchars($row['rid'] ) ); ?>"},
<?php
}
mysqli_close($con);
?>
]
}
]
});
chart.render();
}
</script>
<script src="lib/js/canvasjs.min.js"></script>
<body>
<div id="chartContainer" style="height: 300px; width: 100%;">
</body>