Skip to content

Ng 21.1.5 -> datalabels & Label not found. #2026

@Stan92

Description

@Stan92

Hi,
I'm facing some issues using the latest version of the component

"ng2-charts": "^10.0.0",
"chart.js": "^4.5.1",

With Angular 21.1.5, it doesn't recognize the property datalabels and the class Label

  import { ChartConfiguration, ChartType } from 'chart.js';
  import { BaseChartDirective } from 'ng2-charts';
....
 public pieChartOptions: ChartConfiguration['options'] = {
   responsive: true,
   legend: {
     position: 'top',
   },
   plugins: {
     **datalabels**: {
       formatter: (value, ctx) => {
         const label = ctx.chart.data.labels[ctx.dataIndex];
         return label;
       },
     },
   }
 };
 **public pieChartLabels: Label[] = [];**

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions