首页 > 解决方案 > Two Y-axis not aligning correctly

问题描述

I added two Y-axes into the chart, but for some reason they don't align correctly. The labels to the left are aligned slightly higher than the ones on the right.

enter image description here

What could be the issue here? I've tried messing around with some options etc, but no luck so far.

Any help is appreciated, thank you.

标签: chart.js

解决方案


Assuming your chart is of type 'horizontalBar', you could define the second y-axis as follows:

{
  type: 'category',
  position: 'right', // depends on your choice
  offset: true,
  gridLines: {
    display: false
  }
} 

推荐阅读