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

556
Vistas
Highcharts, datetime, timestamp. What format of date needs when axis has type 'datetime'?

I'm new with Highcharts and stuck with a question. When axis has type 'datetime' what kind of date format it needs, only timestamp? E.g.:

const options: Options = {
        chart: {
            type: 'column',
        },
        xAxis: {
            crosshair: false,
            type: 'datetime', 
            title: {
                text: 'test X,
            },
            labels: {
                format: '{value:%m.%Y}', // here I formate to date
            },
        },
        yAxis: {
            title: {
                text: 'test Y',
            },
        },
        series: [
            {
                name: 'test 1',
                data: [
                    [1483232400000, 1.4],
                    [1483491600000, 5.5],

                ],
            },
            {
                name: 'test 2',
                data: [
                    [1483232400000, 2.4],
                    [1483491600000, null],

                ],
            },
        ],

    };

But can I to pass data like this, with string?:

data: [
        ['2021/12/28', 1.4],
        ['2022/01/28', 1.3],...

or like this:

data: [
        ['28.12.2021', 1.4],
        ['28.01.2022', 1.3],...
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Accorging to the documentation:

type

The type of axis. Can be one of linear, logarithmic, datetime or category. In a datetime axis, the numbers are given in milliseconds, and tick marks are placed on appropriate values like full hours or days. In a category axis, the point names of the chart's series are used for categories, if not a categories array is defined.

you need to use timestamps in milliseconds:

  series: [{
    data: [
      [new Date('2021/12/28').getTime(), 1.4],
      [new Date('2022/01/28').getTime(), 1.3],
      [new Date('2022/02/28').getTime(), 1.3]
    ]
  }]

Live demo: http://jsfiddle.net/BlackLabel/8sqafr27/

API Reference: https://api.highcharts.com/highcharts/xAxis.type

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