gpt4 book ai didi

javascript - Highcharts - 如何在自定义格式化程序中获取默认的 y 轴标签格式化程序

转载 作者:行者123 更新时间:2023-11-29 14:48:34 24 4
gpt4 key购买 nike

我希望写一个自定义标签格式化器,它会在某些情况下显示自定义标签,而在其他情况下返回默认标签:

function yAxisFormatter() {
var val = //need default formatter value here
if(someCondition){
val = ....
}

return val;
}

Doc说默认格式化程序是

function() {
return this.value;
}

但是 this.value 显示的与默认标签不同,我需要默认标签,例如 9k 而不是 9000 等等。

最佳答案

如果其他人偶然发现了这个(就像我一样),您不需要复制核心的一部分。默认格式化程序被定义为轴对象的一部分。你可以像这样回退:

function myCustomFormatter() {
var result = this.axis.defaultLabelFormatter.call(this);
//Do your own things here.
return result;
};

关于javascript - Highcharts - 如何在自定义格式化程序中获取默认的 y 轴标签格式化程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29512623/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com