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

274
Vistas
show percent values instead of value

I am using the apexcharts to generate a "donut". If I move the cursor over an element it will sho me the value of this element:

enter image description here

My code for this:

plotOptions: {
   pie: {
      donut: {
         labels: {
            show: true,
            value: {
               formatter: function (val) {
                  return val;
               }
            }
         }
      }
   }
}

But how can I show the percent value of the element instead of the "normal value"?

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

0

I think the only way is to calculate percentages yourself

formatter: function (val,chart) {
  if(val){
    let valPercent = val/chart.config.series.reduce((a, b) => a + b, 0)*100;
    return `${valPercent.toFixed(1)}%`; // or round with Math
  }
  return ''
}

Actualy there is array with percentage values chart.globals.seriesPercent but no seriesIndex is provided

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