mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix CodeClimate issues
This commit is contained in:
parent
212d513746
commit
47d23601b1
@ -24,11 +24,11 @@ var srcDir = './src/';
|
||||
gulp.task('build', function(){
|
||||
|
||||
// Default to all of the chart types, with Chart.Core first
|
||||
var srcFiles = [FileName('Core')],
|
||||
var srcFiles = [new FileName('Core')],
|
||||
isCustom = !!(util.env.types),
|
||||
outputDir = (isCustom) ? 'custom' : '.';
|
||||
if (isCustom){
|
||||
util.env.types.split(',').forEach(function(type){ return srcFiles.push(FileName(type))});
|
||||
util.env.types.split(',').forEach(function(type){ return srcFiles.push(new FileName(type));});
|
||||
}
|
||||
else{
|
||||
// Seems gulp-concat remove duplicates - nice!
|
||||
@ -46,7 +46,7 @@ gulp.task('build', function(){
|
||||
|
||||
function FileName(moduleName){
|
||||
return srcDir+'Chart.'+moduleName+'.js';
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
@ -109,7 +109,7 @@ gulp.task('module-sizes', function(){
|
||||
.pipe(size({
|
||||
showFiles: true,
|
||||
gzip: true
|
||||
}))
|
||||
}));
|
||||
});
|
||||
|
||||
gulp.task('watch', function(){
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
{
|
||||
return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var width = this.width = computeDimension(context.canvas,'Width') || context.canvas.width;
|
||||
var height = this.height = computeDimension(context.canvas,'Height') || context.canvas.height;
|
||||
@ -44,8 +44,8 @@
|
||||
context.canvas.width = width;
|
||||
context.canvas.height = height;
|
||||
|
||||
var width = this.width = context.canvas.width;
|
||||
var height = this.height = context.canvas.height;
|
||||
width = this.width = context.canvas.width;
|
||||
height = this.height = context.canvas.height;
|
||||
this.aspectRatio = this.width / this.height;
|
||||
//High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale.
|
||||
helpers.retinaScale(this);
|
||||
@ -210,14 +210,18 @@
|
||||
clone = helpers.clone = function(obj){
|
||||
var objClone = {};
|
||||
each(obj,function(value,key){
|
||||
if (obj.hasOwnProperty(key)) objClone[key] = value;
|
||||
if (obj.hasOwnProperty(key)){
|
||||
objClone[key] = value;
|
||||
}
|
||||
});
|
||||
return objClone;
|
||||
},
|
||||
extend = helpers.extend = function(base){
|
||||
each(Array.prototype.slice.call(arguments,1), function(extensionObject) {
|
||||
each(extensionObject,function(value,key){
|
||||
if (extensionObject.hasOwnProperty(key)) base[key] = value;
|
||||
if (extensionObject.hasOwnProperty(key)){
|
||||
base[key] = value;
|
||||
}
|
||||
});
|
||||
});
|
||||
return base;
|
||||
@ -300,9 +304,9 @@
|
||||
})(),
|
||||
warn = helpers.warn = function(str){
|
||||
//Method for warning of errors
|
||||
if (window.console && typeof window.console.warn == "function") console.warn(str);
|
||||
if (window.console && typeof window.console.warn === "function") console.warn(str);
|
||||
},
|
||||
amd = helpers.amd = (typeof define == 'function' && define.amd),
|
||||
amd = helpers.amd = (typeof define === 'function' && define.amd),
|
||||
//-- Math methods
|
||||
isNumber = helpers.isNumber = function(n){
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
@ -526,7 +530,9 @@
|
||||
return -1 * t * (t - 2);
|
||||
},
|
||||
easeInOutQuad: function (t) {
|
||||
if ((t /= 1 / 2) < 1) return 1 / 2 * t * t;
|
||||
if ((t /= 1 / 2) < 1){
|
||||
return 1 / 2 * t * t;
|
||||
}
|
||||
return -1 / 2 * ((--t) * (t - 2) - 1);
|
||||
},
|
||||
easeInCubic: function (t) {
|
||||
@ -536,7 +542,9 @@
|
||||
return 1 * ((t = t / 1 - 1) * t * t + 1);
|
||||
},
|
||||
easeInOutCubic: function (t) {
|
||||
if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t;
|
||||
if ((t /= 1 / 2) < 1){
|
||||
return 1 / 2 * t * t * t;
|
||||
}
|
||||
return 1 / 2 * ((t -= 2) * t * t + 2);
|
||||
},
|
||||
easeInQuart: function (t) {
|
||||
@ -546,7 +554,9 @@
|
||||
return -1 * ((t = t / 1 - 1) * t * t * t - 1);
|
||||
},
|
||||
easeInOutQuart: function (t) {
|
||||
if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t * t;
|
||||
if ((t /= 1 / 2) < 1){
|
||||
return 1 / 2 * t * t * t * t;
|
||||
}
|
||||
return -1 / 2 * ((t -= 2) * t * t * t - 2);
|
||||
},
|
||||
easeInQuint: function (t) {
|
||||
@ -556,7 +566,9 @@
|
||||
return 1 * ((t = t / 1 - 1) * t * t * t * t + 1);
|
||||
},
|
||||
easeInOutQuint: function (t) {
|
||||
if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t * t * t;
|
||||
if ((t /= 1 / 2) < 1){
|
||||
return 1 / 2 * t * t * t * t * t;
|
||||
}
|
||||
return 1 / 2 * ((t -= 2) * t * t * t * t + 2);
|
||||
},
|
||||
easeInSine: function (t) {
|
||||
@ -575,60 +587,95 @@
|
||||
return (t === 1) ? 1 : 1 * (-Math.pow(2, -10 * t / 1) + 1);
|
||||
},
|
||||
easeInOutExpo: function (t) {
|
||||
if (t === 0) return 0;
|
||||
if (t === 1) return 1;
|
||||
if ((t /= 1 / 2) < 1) return 1 / 2 * Math.pow(2, 10 * (t - 1));
|
||||
if (t === 0){
|
||||
return 0;
|
||||
}
|
||||
if (t === 1){
|
||||
return 1;
|
||||
}
|
||||
if ((t /= 1 / 2) < 1){
|
||||
return 1 / 2 * Math.pow(2, 10 * (t - 1));
|
||||
}
|
||||
return 1 / 2 * (-Math.pow(2, -10 * --t) + 2);
|
||||
},
|
||||
easeInCirc: function (t) {
|
||||
if (t >= 1) return t;
|
||||
if (t >= 1){
|
||||
return t;
|
||||
}
|
||||
return -1 * (Math.sqrt(1 - (t /= 1) * t) - 1);
|
||||
},
|
||||
easeOutCirc: function (t) {
|
||||
return 1 * Math.sqrt(1 - (t = t / 1 - 1) * t);
|
||||
},
|
||||
easeInOutCirc: function (t) {
|
||||
if ((t /= 1 / 2) < 1) return -1 / 2 * (Math.sqrt(1 - t * t) - 1);
|
||||
if ((t /= 1 / 2) < 1){
|
||||
return -1 / 2 * (Math.sqrt(1 - t * t) - 1);
|
||||
}
|
||||
return 1 / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1);
|
||||
},
|
||||
easeInElastic: function (t) {
|
||||
var s = 1.70158;
|
||||
var p = 0;
|
||||
var a = 1;
|
||||
if (t === 0) return 0;
|
||||
if ((t /= 1) == 1) return 1;
|
||||
if (!p) p = 1 * 0.3;
|
||||
if (t === 0){
|
||||
return 0;
|
||||
}
|
||||
if ((t /= 1) == 1){
|
||||
return 1;
|
||||
}
|
||||
if (!p){
|
||||
p = 1 * 0.3;
|
||||
}
|
||||
if (a < Math.abs(1)) {
|
||||
a = 1;
|
||||
s = p / 4;
|
||||
} else s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||||
} else{
|
||||
s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||||
}
|
||||
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p));
|
||||
},
|
||||
easeOutElastic: function (t) {
|
||||
var s = 1.70158;
|
||||
var p = 0;
|
||||
var a = 1;
|
||||
if (t === 0) return 0;
|
||||
if ((t /= 1) == 1) return 1;
|
||||
if (!p) p = 1 * 0.3;
|
||||
if (t === 0){
|
||||
return 0;
|
||||
}
|
||||
if ((t /= 1) == 1){
|
||||
return 1;
|
||||
}
|
||||
if (!p){
|
||||
p = 1 * 0.3;
|
||||
}
|
||||
if (a < Math.abs(1)) {
|
||||
a = 1;
|
||||
s = p / 4;
|
||||
} else s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||||
} else{
|
||||
s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||||
}
|
||||
return a * Math.pow(2, -10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) + 1;
|
||||
},
|
||||
easeInOutElastic: function (t) {
|
||||
var s = 1.70158;
|
||||
var p = 0;
|
||||
var a = 1;
|
||||
if (t === 0) return 0;
|
||||
if ((t /= 1 / 2) == 2) return 1;
|
||||
if (!p) p = 1 * (0.3 * 1.5);
|
||||
if (t === 0){
|
||||
return 0;
|
||||
}
|
||||
if ((t /= 1 / 2) == 2){
|
||||
return 1;
|
||||
}
|
||||
if (!p){
|
||||
p = 1 * (0.3 * 1.5);
|
||||
}
|
||||
if (a < Math.abs(1)) {
|
||||
a = 1;
|
||||
s = p / 4;
|
||||
} else s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||||
if (t < 1) return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p));
|
||||
} else {
|
||||
s = p / (2 * Math.PI) * Math.asin(1 / a);
|
||||
}
|
||||
if (t < 1){
|
||||
return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p));}
|
||||
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) * 0.5 + 1;
|
||||
},
|
||||
easeInBack: function (t) {
|
||||
@ -641,7 +688,9 @@
|
||||
},
|
||||
easeInOutBack: function (t) {
|
||||
var s = 1.70158;
|
||||
if ((t /= 1 / 2) < 1) return 1 / 2 * (t * t * (((s *= (1.525)) + 1) * t - s));
|
||||
if ((t /= 1 / 2) < 1){
|
||||
return 1 / 2 * (t * t * (((s *= (1.525)) + 1) * t - s));
|
||||
}
|
||||
return 1 / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);
|
||||
},
|
||||
easeInBounce: function (t) {
|
||||
@ -659,7 +708,9 @@
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (t) {
|
||||
if (t < 1 / 2) return easingEffects.easeInBounce(t * 2) * 0.5;
|
||||
if (t < 1 / 2){
|
||||
return easingEffects.easeInBounce(t * 2) * 0.5;
|
||||
}
|
||||
return easingEffects.easeOutBounce(t * 2 - 1) * 0.5 + 1 * 0.5;
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user