返回顶部

ant-design/charts——柱状图y轴间隔设置为整数

官网:https://ant-design-charts.antgroup.com/options/plots/component/axis

 

我的ant-design/charts版本是2.2.7

 

原效果:

改后效果:

 

代码:

const config: ColumnConfig = {
    ...
    axis: {
      y: {
        tickFilter: (datum: number) => {
          return Number.isInteger(datum)
        }, // 过滤 y 轴刻度线,只显示整数刻度线
      },
    },
    ...
  }

 

posted @ 2025-05-20 16:45  前端-xyq  阅读(129)  评论(0)    收藏  举报