i am using the pie chart which is throwing me some error WRT Chart
( npm install canvasjs ) ran this as well
1.Cannot read property ‘Chart’ of undefined
2.Cannot read property ‘render’ of undefined
HTML
<div id=”chartContainer” style=”height: 370px; width: 100%; margin-left:auto;margin-right:auto;”></div>
Angular
ngOnInit() {
this.debugger
let chart = new this.CanvasJS.Chart(“chartContainer”, {
theme: “light2”,
animationEnabled: true,
exportEnabled: true,
title:{
text: “Monthly Expense”
},
data: [{
type: “pie”,
showInLegend: true,
toolTipContent: “<b>{name}</b>: ${y} (#percent%)”,
indexLabel: “{name} – #percent%”,
dataPoints: [
{ y: 450, name: “Food” },
{ y: 120, name: “Insurance” },
{ y: 300, name: “Traveling” },
{ y: 800, name: “Housing” },
{ y: 150, name: “Education” },
{ y: 150, name: “Shopping”},
{ y: 250, name: “Others” }
]
}]
});
this.chart.render();
console.log(chart.data)
}
please help me .
Thanks,
Sonam