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

116
Visualizações
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 Respostas
Responde à pergunta

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 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