antvis/G2

坐标轴精度显示问题 #3731

xingduo posted onGitHub

  • I have searched the issues of this repository and believe that this is not a duplicate.

Edit on CodeSandbox

Steps to reproduce

坐标轴显示精度保留了是几位数的精度,但这应该并不是我们预期的效果,请问这个问题该如何解决? 坐标配置如下: const battery = new Chart({ container: 'Battery', width: 1328, height: 400, }); battery.data(this.ctempData) battery.scale({ time: { tickCount: 20 }, ctemp: { // nice: true, tickCount: 12 } }); battery.axis('ctemp', { line:{ }, tickLine:{ }, title:{ text:'温度' }, grid:null

        }
    )

效果图如下: image 实际的坐标数据如下: image

Environment Info
g2 4.1.34
System -
Browser -

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


试试tickInterval:0.1调整刻度间距,或者自定义刻度格式

formatter:(val)=>`${Number.parseFloat(val).toFixed(1)}`

tickInterval示例代码

posted by rainy-25Ghz over 3 years ago

Fund this Issue

$0.00
Funded

Pull requests