How to set options in react-chartjs-2?

守給你的承諾、 提交于 2019-12-08 02:32:32

问题


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?


回答1:


<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
        }
     }}
/>


来源:https://stackoverflow.com/questions/43507799/how-to-set-options-in-react-chartjs-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!