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

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