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

408
Visualizações
How to see truncated text with hover in highcharts?

I'm using the highcharts-react-official package and sometimes my charts have texts that are long enough to be truncated. In those cases the texts end with "...".

I would like to be able to see the full text if I hover the mouse over it. Is that possible somehow?

Edited: See the picture. The truncated text is the third one from the top.

Edited: I actually found out that the "tooltip" option can fix this, but I wonder if it's possible to configure the tooltip so that it only appears if the text is truncated?

My chart

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

0

The possible solution is to set custom "ellipsis" in formatter, according to the length of the label text.

  dataLabels: {
    enabled: true,
    inside: true,
    formatter: function() {
      let name = this.key;
      if (name.length > 10) {
        name = name.substring(0, 8) + '...';
      }
      return name;
    }
  },

Then, you can easily check which label has an abbreviated text. For checking it and setting the tooltip on point hover, use the point.mouseOver() event.

  point: {
    events: {
      mouseOver: function() {
        let point = this;
        let name = point.options.name;
        if (name.length > 10) {
          point.series.chart.update({
            tooltip: {
              enabled: true
            }
          });
        }
      },
      mouseOut: function() {
        this.series.chart.update({
          tooltip: {
            enabled: false
          }
        });
      }
    }
  } 

API References: https://api.highcharts.com/highcharts/series.column.events.mouseOver https://api.highcharts.com/highcharts/series.column.events.mouseOut

Demo: https://jsfiddle.net/BlackLabel/c4qezstf/

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