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

174
Views
Chart.js Options doesn't work in React.js

I'm trying to position legend on right of my chart but options doesn't work...

import { Chart } from 'react-chartjs-2';
import 'chart.js/auto';

const data = {
  labels: [
    'Red',
    'Green',
    'Yellow'
],
datasets: [{
  data: [700, 50, 100],
  backgroundColor: [
  '#FF6384',
  '#36A2EB',
  '#FFCE56'
  ],
  hoverBackgroundColor: [
  '#FF6384',
  '#36A2EB',
  '#FFCE56'
  ],
  
}]

};

const TestimonialSection = () => {
  return( 
  <div id="chart">
     <Chart type="doughnut" data={data} options={{legend: {position: 'right'}}}/>
  </div>
  )
}

export default TestimonialSection 

I just wrote this file and chart show up, only things that doesn't work is options. Also checked dependency and all look good

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

for the latest version this is the object structure you must do.

options = {
  plugins: {
    legend: {
      display: false,
      position: right,
      ...

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