Forum Replies Created by prashasti

Viewing 1 post (of 1 total)
  • in reply to: Chart is not vIsible in Google Chrome #20933

    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://canvasjs.com/assets/script/canvasjs.min.js"></script>
    </body>
    </html>
Viewing 1 post (of 1 total)