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

318
Vistas
Amcharts Pie chart - Truncate long labels with small percentages but show them properly in tooltip

I am working with amcharts 4 pie charts. I want to truncate labels which are long and share small percentage so they don't go outside pie chart boundaries as shown in attached image https://ibb.co/0mJnrgy

As per the amcharts documentation (https://www.amcharts.com/docs/v4/tutorials/dealing-with-piechart-labels-that-dont-fit/) I tried truncate=false but unfortunately that didn't work, Not sure why.

So I tried to achieve it using adapters. Below is what I tried so far. This is working but label as well as tooltip both getting truncated. I have gone through lot of documentation but haven't found any proper solution.

Any clue or help is very appreciated.

Demo & progress : https://codepen.io/amitpatil/pen/bGYEdXK?editors=0110

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Nevermind, Managed to find the solution after wasting so many hours.

  series.slices.template.adapter.add('tooltipText', (tooltipText, target) => {
    const {
      dataItem: {
        values: {value : {percent}},
        component: { dataFields : {category} }
      }
    } = target;
    return `${target.dataItem._dataContext[category]} : ${percent}%`;
  }); 

Here is the complete demo https://codepen.io/amitpatil/pen/jOaqJOz?editors=0010

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