简体   繁体   中英

react-chartjs-2 how to show legend text on the left with vertical text

I just want to align the Chart Legend on the right and the text will be shown vertically. Goal: enter image description here

I've tried to use: position: left enter image description here The legend already move to the left. But I don't know how to align the text vertically enter image description here

Ex: enter image description here

I mean, you want to show title to left of chart. In your output, I expect:

const commonOptions: {
    maintainAspectRatio: false,
    interaction: {
           intersect: false,
    },
    responsive: true,
    plugins: {
      legend: {
        position: 'right',
      },
      title: {
                display: true,
                align: 'center',
                text: 'Study Count',
                position: 'left'
            }
    }
  },

Try in:

https://www.chartjs.org/docs/latest/samples/bar/vertical.html

Good lucks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM