antvis / S2

⚡️ A practical visualization library for tabular analysis.
https://s2.antv.antgroup.com
MIT License
1.46k stars 193 forks source link

🐛数据为 null, ‘null’和‘’ 的呈现不一致 #2833

Closed misswangkang closed 1 month ago

misswangkang commented 1 month ago

🏷 Version

Package Version
@antv/s2 1.47.1
@antv/s2-react
@antv/s2-vue

Sheet Type

🖋 Description

在平铺模式中,null 显示为‘null’, 'null' 显示'null', '' 显示‘-’ , 明细表下 null 和'' 都显示为‘-’ image

image image

⌨️ Code Snapshots

🔗 Reproduce Link

🤔 Steps to Reproduce

😊 Expected Behavior

我们希望 能准确区分开 ‘’,‘null’ ,null

😅 Current Behavior

在平铺模式中,null 显示为‘null’, 'null' 显示'null', '' 显示‘-’ , 明细表下 null 和'' 都显示为‘-’

💻 System information

Environment Info
System
Browser
lijinke666 commented 1 month ago

已知问题: https://github.com/antvis/S2/issues/2766 https://github.com/antvis/S2/issues/2808

这是 1.x 版本的设计缺陷, 简单来说就是由于透视表行列头维值默认都是字符串, 内部会强制 String() 处理, 所以如果维值为 null 时会变成 "null", 而明细表除了表头都是数值, 所以能正常展示.

如需使用 1.x 版本, 建议预清洗下数据, 比如把维值为 null 的转成 "", 这样就能正常展示为 "-", 由于涉及到一些重构, 和破坏性改动, 会在 2.x 版本中解决该问题 https://github.com/antvis/S2/pull/2810