自定义单元格对齐方式
上一篇
自定义 Icon
下一篇
自定义单元格宽高
Loading...
在阅读本节内容前,请确保你已经阅读 主题配置 文档
为方便用户查看数据,S2 交叉表会在滑动过程中,保证行头和列头的最大可见性。因此,S2 在行头、列头对齐方式所对应的的范围是当前格子的可视区域,而角头,数据单元格所对应的范围是当前格子的实际尺寸区域。
cornerCell: { bolderText: { textAlign: 'left', textBaseline: 'middle', }, text: { textAlign: 'left', textBaseline: 'middle', } } |
![]() |
cornerCell: { bolderText: { textAlign: 'center', textBaseline: 'middle', }, text: { textAlign: 'center', textBaseline: 'middle', } } |
![]() |
cornerCell: { bolderText: { textAlign: 'right', textBaseline: 'middle', }, text: { textAlign: 'right', textBaseline: 'middle', } } |
![]() |
textBaseline
也有三种模式:top
,middle
,bottom
。效果不再赘述。
rowCell: { bolderText: { textAlign: 'left', }, text: { textAlign: 'left', } } |
![]() |
rowCell: { bolderText: { textAlign: 'center', }, text: { textAlign: 'center', } } |
![]() |
rowCell: { bolderText: { textAlign: 'right', }, text: { textAlign: 'right', } } |
![]() |
列头的滚动对齐只针对于非叶子维度节点,叶子维度节点对齐对应的范围是当前格子的实际尺寸区域。
colCell: { bolderText: { textAlign: 'left', }, measureText: { textAlign: 'left', } } |
![]() |
colCell: { bolderText: { textAlign: 'center', }, measureText: { textAlign: 'center', }, } |
![]() |
colCell: { bolderText: { textAlign: 'right', }, measureText: { textAlign: 'right', } } |
![]() |
dataCell: { bolderText: { textAlign: 'left', textBaseline: 'top', }, text: { textAlign: 'left', textBaseline: 'top', } } |
|
dataCell: { bolderText: { textAlign: 'center', textBaseline: 'middle', }, text: { textAlign: 'center', textBaseline: 'middle', } } |
|
dataCell: { bolderText: { textAlign: 'right', textBaseline: 'bottom', }, text: { textAlign: 'right', textBaseline: 'bottom', } } |
|
有时我们想达到类似 字段标记
的效果,对特定满足条件的单元格进行 自定义对齐方式
, 而不是改变所有,这时我们可以通过 自定义单元格
, 通过 S2 提供的 dataCell
, colCell
, rowCell
等自定义 Hook 来做自定义。