Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!