使用JavaScript自定义轴标签格式:

可以通过JavaScript代码自定义轴标签格式,避免显示重复值。

1. 整数格式:

function() {
    if (this == parseInt(this)) {
        return this;
    } else {
        return " ";
    }
}

2. 保留两位小数格式: 

function() {
    if (this == this.toFixed(2)) {
        return this;
    } else {
        return " ";
    }
}

3. 化为人民币千分位形式并保留两位小数: 

function() {
    if (this == this.toFixed(2)) {
        // 使用toLocaleString方法格式化数字为人民币格式(千分位形式)
        return this.toLocaleString('zh-CN', {
          style: 'currency',       // 指定为货币格式
          currency: 'CNY',         // 指定货币为人民币
          minimumFractionDigits: 2, // 最小小数位数
          maximumFractionDigits: 2  // 最大小数位数
        });
    } else {
        return " ";
    }
}

注:图片来自帆软官方 

Logo

永洪科技,致力于打造全球领先的数据技术厂商,具备从数据应用方案咨询、BI、AIGC智能分析、数字孪生、数据资产、数据治理、数据实施的端到端大数据价值服务能力。

更多推荐