Hi am using chartjs I am getting this error
This is my chart value
this.chartData1 = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'First Dataset',
data: [65, 59, 80, 81, 56, 55, 40]
},
{
label: 'Second Dataset',
data: [28, 48, 40, 19, 86, 27, 90]
}
]
}
this.options = {
title: {
display: true,
text: 'My Title',
fontSize: 16
},
legend: {
position: 'bottom'
}
};
<p-chart type="line" [data]="chartData1" (onDataSelect)="selectData($event)"></p-chart>
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'datasets' -> object with constructor 'Array'
| index 0 -> object with constructor 'Object'
| ...
| property 'config' -> object with constructor 'Object'
--- property 'data' closes the circle
at JSON.stringify (
at JsonPipe.push../node_modules/@angular/common/fesm5/common.js.JsonPipe.transform (common.js:5211)
at Object.eval [as updateRenderer] (SiteReportsComponent.html:43)
at Object.debugUpdateRenderer [as updateRenderer] (core.js:23927)
at checkNoChangesView (core.js:23281)
at callViewAction (core.js:23518)
at execComponentViewsAction (core.js:23480)
at checkNoChangesView (core.js:23282)
at callViewAction (core.js:23518)
at execComponentViewsAction (core.js:23480)
ERROR TypeError: "cyclic object value"
How to fix this error ?
This is a question not an issue, it should not be posted here. Also please make a stackblitz in the future.
When I tried the code in stackblitz it worked fine -

@JacobSiegle , thanks a lot for the update!
Best Regards,
I figure out the issue. If you print the chart data on the screen like this {{data}} This error appearing :)
Most helpful comment
I figure out the issue. If you print the chart data on the screen like this {{data}} This error appearing :)