Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Chart.js中的逗号_Javascript_Jquery_Chart.js - Fatal编程技术网

Javascript Chart.js中的逗号

Javascript Chart.js中的逗号,javascript,jquery,chart.js,Javascript,Jquery,Chart.js,我试图在Chart.js的y轴(3000、4000、5000等)上的数字中添加逗号。我试图遵循这个思路 我试着跟着这些片段,但是我得到了未定义的“numberWithCommas” 对这个javascript有什么想法吗? DatabaseDecay.prototype.updateChart=function(){ var图表、ctx、数据、期权; $(“#图表”)。替换为(“”); 变量编号,带逗号=函数(x){ 返回x.toString().replace(/\B(?=(\d{3

我试图在Chart.js的y轴(3000、4000、5000等)上的数字中添加逗号。我试图遵循这个思路

我试着跟着这些片段,但是我得到了未定义的“numberWithCommas”

对这个javascript有什么想法吗?
DatabaseDecay.prototype.updateChart=function(){
var图表、ctx、数据、期权;
$(“#图表”)。替换为(“”);
变量编号,带逗号=函数(x){
返回x.toString().replace(/\B(?=(\d{3})+(?!\d))/g,“,”;
};
ctx=document.getElementById(“图表”).getContext(“2d”);
数据={
标签:['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18'],
数据集:[
{
标签:“衰变图”,
填充颜色:“#bdd4de”,
highlightFill:“#cfcfcf”,
数据:this.getChartData()
}
]
};
选项={
回答:是的,
工具脚本模板:“”,
ScaleShowVerticalline:错误,
scaleLabel:“
};
图表=新图表(ctx).Bar(数据、选项);
返回控制台日志(图表);
};
DatabaseDecay.prototype.getChartData=函数(){
var数据,i,j,leftRecords;
数据=[];
对于(i=j=0;j本记录){
将此文件归还给您的记录;
}
返回结果;
};
DatabaseDecay.prototype.getLeftRecords=函数(月){
返回此。getDecayedRecords(月);
};
DatabaseDecay.update=函数(){
返回instance.update();
};
DatabaseDecay.reveal=函数(){
$('.calculator--form').find('.lg btn secondary').text('calculator reach');
$('.stats').addClass('stats_opened');
$('.stats heading').addClass('stats_opened');
$('.chart--container').addClass('chart--container_opened');
实例| |新数据库衰退();
返回instance.update();
};
返回数据库衰退;

})();
var numberwhithcommas=函数(x){
更改为

Chart.numberWithCommas = function(x) {
然后呢

scaleLabel: "<%=Chart.numberWithCommas(value)%>"
scaleLabel:“