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

155
Visualizações
Remove animation time for chartjs datapoints

I have created a simple line chart in chartjs. when I hover with the mouse over a single datapoint, a box pops up that tells me the data's value, the x-axis value and the name of the statistic. The black box doesn't appear at once, there is a fade-in. I would like the box to appear immediately without fade-in, so I'm basically trying to se the animation time to 0. How do I do this?

Below is how the graph is being written right now:

chart_code = new Chart(ctx, {
type: 'line',
data: {
  labels: ['A','B','C','D','E'],
  datasets: [{
    label: 'Teststatistic',
    data: [50,40,30,20,50],
    backgroundColor: ['rgba(0, 105, 146, 1)'],
    borderColor: ['rgba(0, 105, 146, 1)'],
    borderWidth: 3,
    fill: false,
    pointStyle: 'rect',
    pointRadius: 5
  }]
},
options: {
  responsive: false,
  plugins: {
    legend: {
      display: false,
      boxWidth: 80,
      boxHeight: 80
    }
  },
  scales: {
    x: { 
      ticks: {
        maxRotation: 0, 
        minRotation: 0
      } 
    }
  }
}

}

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

0

You can set animation to false in the tooltip config like so:

var options = {
  type: 'line',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
        label: '# of Votes',
        data: [12, 19, 3, 5, 2, 3],
        borderColor: 'pink'
      },
      {
        label: '# of Points',
        data: [7, 11, 5, 8, 3, 7],
        borderColor: 'orange'
      }
    ]
  },
  options: {
    plugins: {
      tooltip: {
        animation: false
      }
    }
  }
}

var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
  <canvas id="chartJSContainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.js"></script>
</body>

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