Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set options in react-chartjs-2?

React Charts 2 https://github.com/gor181/react-chartjs-2

is referencing below

Chart JS http://www.chartjs.org/docs/#getting-started

The docs in react-chartjs-2 references chart.js docs and they're all wrong. I can't figure out how to configure the charts in react, specifically the options. Does anybody know?

like image 584
ProgrammingGodJK Avatar asked Apr 19 '17 23:04

ProgrammingGodJK


1 Answers

<Bar
    data={{
      labels: this.props.labels,
      datasets: this.props.data
    }}
     options={{
       legend: {
         display: false
       },
       scales: {
         yAxes: [{
           ticks: {
              max: this.props.maxY,
              min: 0,
              stepSize: 3
            }
          }]
         },
        title: {
         display: this.props.display,
         text: this.props.title
        }
     }}
/>
like image 200
Stef12 Avatar answered Sep 25 '22 08:09

Stef12