antvis/G2

功能需求 #6270

evie-park posted onGitHub

我们使用本图表是为了使用小数点1位的温度数据。使用中Y轴上的极差有自动变化,对于温度偏差较小的值,图表极差范围自动放大,显实10位小数的情况。为了固定显实1位小数点,应该怎么做呢?


设置 y scale 的最大最小值范围即可。

posted by hustcc 11 months ago

I applied the format of the label in y axis by changing it. Below is the actual application code.

        yAxis: {
            label: {
                // 소수점 1자리로 포맷 변경
                formatter: (v: any) => {
                    const formattedValue = `${v}`.replace(/\.(\d).*$/, '.$1');
                    return formattedValue;
                },
            },
        },

Thanks for your help.

posted by evie-park 11 months ago

The problem has been resolved, so I will close it. :)

posted by evie-park 11 months ago

Fund this Issue

$0.00
Funded

Pull requests