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

192
Visualizações
Recharts - Draw a trend line on top of a barchart

Hi I am creating a barchart using the Recharts library. I am wanting to draw a trend line on top of the barchart like so: enter image description here

I am using the following to draw the barchart:

       <BarChart data={transformedDataByCategory}>
            <CartesianGrid strokeDasharray="3 3" vertical={false} />
            <XAxis
              dataKey="category"
              interval={0}
              tickLine={false}
              tick={(e) => {
                const { payload: { value } } = e;
                e.fill = theme.colors.onfCategory[value].base;
                e.fontSize = '11px';
                e.fontWeight = 'bold';
                return <ChartText {...e}>{value}</ChartText>;
              }}
            />
            <YAxis />
            <Legend />
            <Tooltip cursor={{ fill: '#f1f1f1' }} />

            {years.map((year, i) => <>
              <Bar key={`year_${i}`} dataKey={year} fill={yearColours[i]}/>
            </>)}
       </BarChart>

I have tried using the ReferenceLine component to draw on top of the graph but have had no luck. Any help would be great thanks!

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