echarts图表内容溢出,超出容器的部分不展示了

573 阅读1分钟

image.png 可以看到由于数字比较大,79066只展示到了790,就被容器覆盖不再展示了。 解决办法: (1)option配置项中使用grid,调整其中的left、right、top、bottom值即可

grid: {
  // 防止标签溢出
  containLabel: true,
  top: 10,
  left: 10,
  right: '10%',
  bottom: 10,
},

(2)option配置项中的xAxis中的boundaryGap,调整其中的数据即可

xAxis: {
  boundaryGap: [0, '20%'],
}

也可两个混合使用进行调整