I am creating my control panel and liked to create a chart to show data from my table but is giving me this error. Uncaught ReferenceError: Chart is not defined I do not know much about javascript. If anyone could help me grateful.
Html
<div class="box-body no-padding">
<canvas id="canvas" height="450" width="610"></canvas>
</div><!-- /.box-body -->
My script
<script>
var PieChart = [
{
value: 40,
color:"#fcc79e"
},
{
value : 30,
color : "#beefd2"
},
{
value : 90,
color : "#ffddfb"
}
];
var myPieChart = new Chart(document.getElementById("canvas").getContext("2d")).Pie(PieChart);
</script>
Update your library. I have test this and working.
<div class="box-body no-padding">
<canvas id="canvas" height="450" width="610"></canvas>
</div>
<script src="https://raw.githubusercontent.com/nnnick/Chart.js/master/Chart.min.js" ></script>
<script>
var PieChart = [
{
value: 40,
color:"#fcc79e"
},
{
value : 30,
color : "#beefd2"
},
{
value : 90,
color : "#ffddfb"
}
];
var myPieChart = new Chart(document.getElementById("canvas").getContext("2d")).Pie(PieChart);
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.