答案 0 :(得分:0)
在711 - 737行之间,我在'£' +
之前添加了所有这些值,它就像魅力一样
// set value to display
if (obj.config.textRenderer) {
obj.originalValue = obj.config.textRenderer('£' + obj.originalValue);
} else if (obj.config.humanFriendly) {
obj.originalValue = humanFriendlyNumber('£' + obj.originalValue, obj.config.humanFriendlyDecimal) + obj.config.symbol;
} else if (obj.config.formatNumber) {
obj.originalValue = formatNumber('£' + obj.originalValue) + obj.config.symbol;
} else {
obj.originalValue = ('£' + obj.originalValue * 1).toFixed(obj.config.decimals) + obj.config.symbol;
}
if (obj.config.counter === true) {
//on each animation frame
eve.on("raphael.anim.frame." + (obj.level.id), function() {
var currentValue = obj.level.attr("pki");
if (obj.config.textRenderer) {
obj.txtValue.attr("text", '£' + obj.config.textRenderer(Math.floor(currentValue[0])));
} else if (obj.config.humanFriendly) {
obj.txtValue.attr("text", '£' + humanFriendlyNumber(Math.floor(currentValue[0]), obj.config.humanFriendlyDecimal) + obj.config.symbol);
} else if (obj.config.formatNumber) {
obj.txtValue.attr("text", '£' + formatNumber(Math.floor(currentValue[0])) + obj.config.symbol);
} else {
obj.txtValue.attr("text", '£' + (currentValue[0] * 1).toFixed(obj.config.decimals) + obj.config.symbol);
}
setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY);
currentValue = null;
});
答案 1 :(得分:0)
您可以指定textRenderer函数来执行此操作。例如:
this.chartCosts = new window.JustGage({
id: "chartCosts",
value: 12000,
min: 0,
max: 50000,
title: "Costs",
textRenderer: function(num) {
return "£ " + numeral(num).format("0,0");
}
});