Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doughnut/Pie chart: Uncaught TypeError: Cannot read properties of undefined (reading 'display') #1742

Open
DevWedeloper opened this issue Sep 21, 2023 · 0 comments

Comments

@DevWedeloper
Copy link

DevWedeloper commented Sep 21, 2023

zone.js:177 Uncaught TypeError: Cannot read properties of undefined (reading 'display')
at RadialLinearScale.drawGrid (chart.js:10836:24)
at Object.draw (chart.js:4830:26)
at Chart.draw (chart.js:6048:23)
at chart.js:64:23
at Map.forEach ()
at Animator._update (chart.js:42:22)
at chart.js:33:18
at timer (zone.js:2367:41)
at _ZoneDelegate.invokeTask (zone.js:402:31)
at Zone.runTask (zone.js:173:47)

I just copied this from stackblitz template:

`<canvas
baseChart
[labels]="doughnutChartLabels"
[datasets]="doughnutChartDatasets"
[options]="doughnutChartOptions"
[type]="'doughnut'"

import { ChangeDetectionStrategy, Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { NgChartsModule } from 'ng2-charts'; import { ChartConfiguration } from 'chart.js';

@component({
selector: 'app-doughnut-chart',
standalone: true,
imports: [CommonModule, NgChartsModule],
templateUrl: './doughnut-chart.component.html',
styleUrls: ['./doughnut-chart.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DoughnutChartComponent {
doughnutChartOptions: ChartConfiguration<'doughnut'>['options'] = {
responsive: false,
};

doughnutChartLabels: string[] = [
'Download Sales',
'In-Store Sales',
'Mail-Order Sales',
];

doughnutChartDatasets: ChartConfiguration<'doughnut'>['data']['datasets'] = [
{ data: [350, 450, 100], label: 'Series A' },
{ data: [50, 150, 120], label: 'Series B' },
{ data: [250, 130, 70], label: 'Series C' },
];
}`

Angular version 16.1.0
"chart.js": "^4.4.0"
"ng2-charts": "^5.0.3"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant