Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

691
Views
chart.js no tiene un miembro exportado llamado 'ChartDataSets'. ¿Quiso decir 'chartdataset'? ts(2724)

Cuando importo ChartDataSets , aparece un mensaje de error en line-chart.component.ts

 '"chart.js"' has no exported member named 'ChartDataSets'. Did you mean 'ChartDataset'?ts(2724

ingrese la descripción de la imagen aquí

no entiendo donde esta el problema ¿Olvidé instalar una biblioteca?

Mi código se presenta así en line-chart.component.ts

 import { Component, } from '@angular/core'; import { ChartDataSets, ChartOptions } from 'chart.js'; import { Color, Label } from 'ng2-charts'; @Component({ selector: 'app-line-chart', templateUrl: './line-chart.component.html', styleUrls: ['./line-chart.component.css'] }) export class LineChartComponent { lineChartData: ChartDataSets[] = [ { data: [85, 72, 78, 75, 77, 75], label: 'Crude oil prices' }, ]; lineChartLabels: Label[] = ['January', 'February', 'March', 'April', 'May', 'June']; lineChartOptions = { responsive: true, }; lineChartColors: Color[] = [ { borderColor: 'black', backgroundColor: 'rgba(255,255,0,0.28)', }, ]; lineChartLegend = true; lineChartPlugins = []; lineChartType = 'line'; }

En line-chart.component.html tengo esto:

 <div class="chart-wrapper"> <canvas baseChart [datasets]="lineChartData" [labels]="lineChartLabels" [options]="lineChartOptions" [colors]="lineChartColors" [legend]="lineChartLegend" [chartType]="lineChartType" [plugins]="lineChartPlugins"> </canvas> </div>

Luego en app.module.ts

 import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { ChartsModule } from 'ng2-charts'; import { AppComponent } from './app.component'; import { LineChartComponent } from './line-chart/line-chart.component'; @NgModule({ declarations: [ AppComponent, LineChartComponent ], imports: [ BrowserModule, ChartsModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }

Te agradezco de antemano por tu ayuda.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Eso sucedió debido a la incompatibilidad de versiones. Intente cambiar ChartDataSets a ChartDataSet .

Aquí hay una muestra de trabajo en StackBlitz

También puedes ver esto

over 4 years ago · Santiago Trujillo Report

0

"ng2-charts": "^2.4.2", "chart.js": "^2.9.3",

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!