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

115
Vistas
plotOptions - show values at the beginning

this is my donut chart (ApexCharts):

var options = {
            series: [umsatzSum, ausgabenSum, auslagenSum],
            chart: {
                type: 'donut',
                height: 320,
                fontFamily: chartFontStyle
            },
            labels: ["Umsatz", "Ausgaben", "Auslagen"],
            colors:['#7ebd0b', '#661818', "#333"],
            track: {
                background: "#cccccc"
            },
            dataLabels: {
                enabled: false
            },
            stroke: {
                colors:['#7ebd0b', '#661818', "#333"],
            },
            plotOptions: {
                pie: {
                    donut: {
                        labels: {
                            show: true,
                            value: {
                                formatter: function (val,chart) {
                                    let valPercent = val/chart.config.series.reduce((a, b) => a + b, 0)*100;
                                    return Math.round(valPercent) + "%"
                                }  
                            }
                        }
                    }
                }
            }
        
var chart = new ApexCharts(document.querySelector("#myChart"), options);
chart.render();

Result: enter image description here

And If I mouse over a series element, it will show this: enter image description here

And If I click on the series element, the percent value in the middle stays How can I realize, that the percent value will be show at the beginning (after the chart was created), without hover or click an element first?

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

0

https://apexcharts.com/docs/options/plotoptions/pie/#total total will be shown when no series is selected or hovered over.

      labels: {
        show: true,
        value: {
          formatter: function (val,chart) {...}
        },
        total: {
          show: true,
          label: 'Umsatz',
          color: '#7ebd0b',
          formatter: function (chart) {
            let seriesToShowId = 0
            let val = chart.config.series[seriesToShowId]
            let valPercent = val/chart.config.series.reduce((a, b) => a + b, 0)*100;
            return Math.round(valPercent) + "%"
          }
        }
      }
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