I am using primeng beta 7 and I am trying to create a pie chart following the demo example. I receive following error.

My ts code is
锘縤mport {Component} from '@angular/core';
import {UIChart} from 'primeng/primeng';
@Component({
selector: 'chart-comp',
templateUrl: '/app/components/chart-comp.component.html',
directives: [UIChart]
})
export class ChartComponent {
data: any;
constructor() {
this.data = {
labels: ['A', 'B', 'C'],
datasets: [
{
data: [300, 50, 100],
backgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
],
hoverBackgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
]
}]
};
}
}
and the html
<p-chart [type]="pie" [data]="data"></p-chart>
any idea?
What is your charts.js version? You need 2.1.x
I have tried both 2.1.3 and 2.1.4
Having the same issue. The code is nearly identical as above. Tried 2.1.3 and 2.1.4
Another case of bad documentation on their website. You need to remove the brackets around type.
<p-chart [type]="line" [data]="data"></p-chart>
to
<p-chart type="line" [data]="data"></p-chart>
Thanks @danielfs1
I had been banging my head for last 3 hours. Finally issue resolved and able to see the chart on screen.
@danielfs1 thanks
Fixed the doc locally and it will be available tomorrow online, please report any documentation error at our issue tracker to let us know.
Most helpful comment
Another case of bad documentation on their website. You need to remove the brackets around type.
<p-chart [type]="line" [data]="data"></p-chart>to
<p-chart type="line" [data]="data"></p-chart>