Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

275
Vistas
Change display format for time chart with chartjs

I can't understand how I am supposed to use Date with chartjs and documentation or example I found are pretty messy.

Can you help me figure out what is wrong in my code.

I have the following options for my chart

const chartOptions = {
  scale: {
    x: {
      type: 'time',
      time: {
        unit: 'minute',
      },
    },
    y: {
      type: 'linear',
    },
  },
};

And the following data :

const data = {
  datasets: [{
     data: [{x: "2022-02-09T20:50:19.123Z", y: 10},
            {x: "2022-02-09T20:50:20.111Z", y: 10},
            {x: "2022-02-09T20:50:21.211Z", y: 10},
            {x: "2022-02-09T20:50:22.456Z", y: 10},
            {x: "2022-02-09T20:50:23.985Z", y: 10}]
   }]
};

I got the following result example chart result

And I would like to have a format like "[hour]:[minute]". I tried many options (unit, displayFormats, round, etc...) which I didn't fullyunderstood and none changed anything.

I also tried to change my data by passing luxon.DateTime.fromIso(mystring) result, then I just have a wrong chart : bad chart result

I am completly lost, thanks for any help.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda