Primeng: chart - ERROR TypeError: "cyclic object value"

Created on 16 Aug 2019  路  3Comments  路  Source: primefaces/primeng

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 ?

cannot-replicate

Most helpful comment

I figure out the issue. If you print the chart data on the screen like this {{data}} This error appearing :)

All 3 comments

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 -
image

@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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

papiroca-tm picture papiroca-tm  路  3Comments

lilling picture lilling  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments

Helayxa picture Helayxa  路  3Comments

jisqaqov picture jisqaqov  路  3Comments