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

195
Views
la escala de tiempo de react chart.js no funciona con el adaptador date-fns

Estoy tratando de hacer que la escala de tiempo (eje x) funcione con el adaptador date-fns -fns y obtengo un "error" para chartjs-adapter-date-fns que podría ser el problema:

 Could not find a declaration file for module 'chartjs-adapter-date-fns'. 'C:/react/envirodata/node_modules/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.js' implicitly has an 'any' type. Try `npm i --save-dev @types/chartjs-adapter-date-fns` if it exists or add a new declaration (.d.ts) file containing `declare module 'chartjs-adapter-date-fns';`ts(7016)

Mi configuración es así:

 import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend, } from 'chart.js'; import "chartjs-adapter-date-fns"; import {Line} from 'react-chartjs-2'; import zoomPlugin from "chartjs-plugin-zoom"; ChartJS.register( CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend, zoomPlugin );

y las opciones son asi:

 plugins: { scales: { x: { type: 'time', adapters: { date: { locale: en } ...

He probado diferentes formatos de fecha para la escala de tiempo. Por ejemplo:

  1. etiquetas: [20220224, 20220225...]
  2. datos: [{x: 1617253200000, y: 1}, ...]
  3. datos: [{x: 2022-02-24, y: 1}, ...]

Pero nada parece funcionar y las fechas se muestran como una cadena. Entonces, aparte de chartjs-adapter-date-fns , no estoy seguro de si hay un problema con la configuración.

about 4 years ago · Juan Pablo Isaza
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!