Home › Forums › Report Bugs › Chart is not vIsible in Google Chrome › Reply To: Chart is not vIsible in Google Chrome
My chart is not displaying.
Following is my code:
<?php
$con = mysqli_connect("localhost","root","root","current_resources");
$result= mysqli_query($con, "SELECT Publisher,COUNT(Publisher) FROM resources GROUP BY Publisher");
// $result2 = mysqli_query($con, "SELECT FROM resources GROUP BY Publisher");
while($row = mysqli_fetch_array($result))
{
$dataPoints= array("label" => $row['Publisher'] , "y" => $row['COUNT(Publisher)']);
}
?>
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
text: "Publisher "
},
subtitles: [{
text: "Statistics"
}],
data: [{
type: "pie",
yValueFormatString: "#,##0.00\"%\"",
indexLabel: "{label} ({y})",
dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
}]
});
chart.render();
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
</body>
</html>