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

449
Visualizações
Is it possible to display the label of each bar outside the upper bound of a bar chart using react-apexcharts?

I am editing a bar chart that should display the values ​​above each bar. I need the values ​​to be displayed outside the upper limit of the chart. I managed to get this graph:

chart i have

However, I need the values ​​to be displayed as if it were a double x-axis (my understanding is that apexchart only has double-axis implemented for the y-axis). In a nutshell, I need this:

chart i need

I managed to move the labels to the top using "offsety" inside "datalabels" in my chart options, but they stay inside the chart, sitting right on the line of the maximum value of the y-axis (and I need them to be located above this line ).

These are my chart options:

  const options = {
    grid: {
      position: 'front'
    },
    legend:{
      position: "bottom",
      horizontalAlign: "right",
      offsetY: 10
    },
    colors:["#59ad30","#134E32","#3A7B05","#59AD31"],
    chart: {
      toolbar:{show:false},
      type: 'bar',
      height: 350
    },
    plotOptions: {
      bar: {
        dataLabels: {
          position: 'top',
        },
        columnWidth: `${categorias.length*13}%`,
      },
    },
    dataLabels: {
      enabled: true,
      formatter: function (val, opts) {
        return `${val.toFixed(1)} Lt`
      },
      offsetY: -1000,
      style: {
        fontSize: '11px',
        fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
        fontWeight: undefined,
        colors: ["#000000"]
    },
    },
    stroke: {
      show: true,
      width: 2,
      colors: ['transparent']
    },
    xaxis: {
      categories: categorias,
      labels:{
        style: {
          fontWeight: "bold",
      },
      }
    },
    yaxis: {
      labels: {
        formatter: function(val) {
          return `${Math.floor(val)} Lt`
        }
      }
    },
    fill: {
      opacity: 1
    },
    tooltip: {
      y: {
        formatter: function (val) {
          return `${val} lts`
        }
      }
    }
  };

apexcharts version: "^3.35.3"

react-apexcharts version: "^1.4.0"

about 4 years ago · Juan Pablo Isaza
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