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

262
Visualizações
Hide tooltip when hovering over null-values in chart.js

I am currently using a line-chart with chart.js 3.5.0 and react-chart-js 3.0.4, given two datasets.

The first dataset has data in {x,y}-format with null-values for some y. When hovering over those null-values, the tooltip jumps to the start of the second dataset. In this case, I would like to hide the tooltip, but approaching the problem with callbacks didn't work.

Has anybody experienced the same issue?

Screenshot

codesandbox

const options = {
    interaction: {
        intersect: false
    },
    maintainAspectRatio: true,
    animation: false,
    plugins: {
        tooltip: {
            mode: 'nearest',
            axis: 'x',
            position: 'average',
            yAlign: "bottom"
        },
    },
    scales: {
        y: {
            type: 'linear',
            beginAtZero: true,
            min: 0,
            grace: '20%',
        }
    },
    chartArea: {
        backgroundColor: "rgb(240,240,240)"
    }
}
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

You can use mode: 'x' in your tooltip config. Together with setting pointHitRadius to 0 in both datasets makes it so you dont have duplicate values in your tooltip.

Example: https://codesandbox.io/s/hardcore-brown-1vxcjh?file=/src/components/CChart.jsx

about 4 years ago · Santiago Gelvez 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