Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
Chart.js timeseries x ticks overlapping due to weekend

I use Chart.js to plot a line chart. My x axis is a timeseries. However, I have ticks overlapping due to weekend data.

Is there any way to avoid overlapping ticks? I used "autoskip: true" but it doesn't seem to work.

Here's how my configs look like:

           x: {
              parsing: false,
              type: "timeseries",
              time: {
                displayFormats: {
                  second: "HH:mm",
                  minute: "HH:mm",
                  hour: "HH:mm",
                  day: "MMM d",
                },
                tooltipFormat: "d MMM HH:mm",
              },
              grid: {
                display: false,
              },
              ticks: {
                autoskip: true,
              },
            },

And this is how the overlapping looks like:

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can achieve what you're looking for by writing a callback function that checks if the value is a weekend day

new Date(Date.parse(value)).getDay() == 1 || new Date(Date.parse(value)).getDay() == 2

If it is we just don't return it. Otherwise we return the value without changes.
This is how your config should look like:

x:{
   type: 'timeseries'
   time:{
         unit:'day',
   },
   ticks:{
        callback: function(value){
            //if weekend dont return the tick label
            if(new Date(Date.parse(value)).getDay() == 1 || new Date(Date.parse(value)).getDay() == 2 )
                return
            return value
        }
   }
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda