radix: 2
vars-on-top: 0
wrap-iife: 2
- yoda: [2, never]
+ yoda: [1, never]
# Strict
strict: 0
if (value < 0) {
return yScale.getPixelForValue(sumNeg + value);
- } else {
- return yScale.getPixelForValue(sumPos + value);
}
+ return yScale.getPixelForValue(sumPos + value);
}
return yScale.getPixelForValue(value);
startCorner = 0;
}
- function cornerAt(index) {
- return corners[(startCorner + index) % 4];
+ function cornerAt(cornerIndex) {
+ return corners[(startCorner + cornerIndex) % 4];
}
// Draw rectangle from 'startCorner'
if (value < 0) {
return xScale.getPixelForValue(sumNeg + value);
- } else {
- return xScale.getPixelForValue(sumPos + value);
}
+ return xScale.getPixelForValue(sumPos + value);
}
return xScale.getPixelForValue(value);
index: i
};
});
- } else {
- return [];
}
+ return [];
}
},
var total = this.getMeta().total;
if (total > 0 && !isNaN(value)) {
return (Math.PI * 2.0) * (value / total);
- } else {
- return 0;
}
+ return 0;
},
// gets the max border or hover width to properly scale pie charts
var rightValue = Number(yScale.getRightValue(value));
if (rightValue < 0) {
return yScale.getPixelForValue(sumNeg + rightValue);
- } else {
- return yScale.getPixelForValue(sumPos + rightValue);
}
+ return yScale.getPixelForValue(sumPos + rightValue);
}
return yScale.getPixelForValue(value);
index: i
};
});
- } else {
- return [];
}
+ return [];
}
},
var count = this.getMeta().count;
if (count > 0 && !isNaN(value)) {
return (2 * Math.PI) / count;
- } else {
- return 0;
}
+ return 0;
}
});
};
return this;
},
- resize: function resize(silent) {
+ resize: function(silent) {
var me = this;
var chart = me.chart;
var canvas = chart.canvas;
if (options.scales) {
items = items.concat(
(options.scales.xAxes || []).map(function(xAxisOptions) {
- return {options: xAxisOptions, dtype: 'category'}; }),
+ return {options: xAxisOptions, dtype: 'category'};
+ }),
(options.scales.yAxes || []).map(function(yAxisOptions) {
- return {options: yAxisOptions, dtype: 'linear'}; }));
+ return {options: yAxisOptions, dtype: 'linear'};
+ })
+ );
}
if (options.scale) {
}, me);
},
- update: function update(animationDuration, lazy) {
+ update: function(animationDuration, lazy) {
var me = this;
Chart.plugins.notify('beforeUpdate', [me]);
}
},
- render: function render(duration, lazy) {
+ render: function(duration, lazy) {
var me = this;
Chart.plugins.notify('beforeRender', [me]);
getVisibleDatasetCount: function() {
var count = 0;
for (var i = 0, ilen = this.data.datasets.length; i<ilen; ++i) {
- if (this.isDatasetVisible(i)) {
+ if (this.isDatasetVisible(i)) {
count++;
}
}
}
},
- eventHandler: function eventHandler(e) {
+ eventHandler: function(e) {
var me = this;
var tooltip = me.tooltip;
var options = me.options || {};
if (key[0] === '_') {
// Only non-underscored properties
- }
-
// Init if doesn't exist
- else if (!me._view.hasOwnProperty(key)) {
+ } else if (!me._view.hasOwnProperty(key)) {
if (typeof value === 'number' && !isNaN(me._view[key])) {
me._view[key] = value * ease;
} else {
me._view[key] = value;
}
- }
-
// No unnecessary computations
- else if (value === me._view[key]) {
+ } else if (value === me._view[key]) {
// It's the same! Woohoo!
- }
-
// Color transitions if possible
- else if (typeof value === 'string') {
+ } else if (typeof value === 'string') {
try {
var color = helpers.color(me._model[key]).mix(helpers.color(me._start[key]), ease);
me._view[key] = color.rgbString();
} catch (err) {
me._view[key] = value;
}
- }
// Number transitions
- else if (typeof value === 'number') {
+ } else if (typeof value === 'number') {
var startVal = me._start[key] !== undefined && isNaN(me._start[key]) === false ? me._start[key] : 0;
me._view[key] = ((me._model[key] - startVal) * ease) + startVal;
- }
// Everything else
- else {
+ } else {
me._view[key] = value;
}
}, me);
if (vm) {
return (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2));
- } else {
- return false;
}
+ return false;
},
inRange: function(chartX, chartY) {
var vm = this._view;
withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius);
return (betweenAngles && withinRadius);
- } else {
- return false;
}
+ return false;
},
tooltipPosition: function() {
var vm = this._view;
// Helper function to draw a line to a point
function lineToPoint(previousPoint, point) {
- var vm = point._view;
+ var pointvm = point._view;
if (point._view.steppedLine === true) {
- ctx.lineTo(point._view.x, previousPoint._view.y);
- ctx.lineTo(point._view.x, point._view.y);
+ ctx.lineTo(pointvm.x, previousPoint._view.y);
+ ctx.lineTo(pointvm.x, pointvm.y);
} else if (point._view.tension === 0) {
- ctx.lineTo(vm.x, vm.y);
+ ctx.lineTo(pointvm.x, pointvm.y);
} else {
ctx.bezierCurveTo(
previousPoint._view.controlPointNextX,
previousPoint._view.controlPointNextY,
- vm.controlPointPreviousX,
- vm.controlPointPreviousY,
- vm.x,
- vm.y
+ pointvm.controlPointPreviousX,
+ pointvm.controlPointPreviousY,
+ pointvm.x,
+ pointvm.y
);
}
}
if (spanGaps && lastDrawnIndex !== -1) {
// We are spanning the gap, so simple draw a line to this point
lineToPoint(previous, current);
+ } else if (loop) {
+ ctx.lineTo(currentVM.x, currentVM.y);
} else {
- if (loop) {
- ctx.lineTo(currentVM.x, currentVM.y);
- } else {
- ctx.lineTo(currentVM.x, scaleZero);
- ctx.lineTo(currentVM.x, currentVM.y);
- }
+ ctx.lineTo(currentVM.x, scaleZero);
+ ctx.lineTo(currentVM.x, currentVM.y);
}
} else {
// Line to next point
// defaults to unit's corresponding unitFormat below or override using pattern string from http://momentjs.com/docs/#/displaying/format/
displayFormats: {
- 'millisecond': 'h:mm:ss.SSS a', // 11:20:01.123 AM,
- 'second': 'h:mm:ss a', // 11:20:01 AM
- 'minute': 'h:mm:ss a', // 11:20:01 AM
- 'hour': 'MMM D, hA', // Sept 4, 5PM
- 'day': 'll', // Sep 4 2015
- 'week': 'll', // Week 46, or maybe "[W]WW - YYYY" ?
- 'month': 'MMM YYYY', // Sept 2015
- 'quarter': '[Q]Q - YYYY', // Q3
- 'year': 'YYYY' // 2015
+ millisecond: 'h:mm:ss.SSS a', // 11:20:01.123 AM,
+ second: 'h:mm:ss a', // 11:20:01 AM
+ minute: 'h:mm:ss a', // 11:20:01 AM
+ hour: 'MMM D, hA', // Sept 4, 5PM
+ day: 'll', // Sep 4 2015
+ week: 'll', // Week 46, or maybe "[W]WW - YYYY" ?
+ month: 'MMM YYYY', // Sept 2015
+ quarter: '[Q]Q - YYYY', // Q3
+ year: 'YYYY' // 2015
}
},
ticks: {
var me = this;
if (me.options.time.unit === 'week' && me.options.time.isoWeekday !== false) {
return tick.clone().startOf('isoWeek').isoWeekday(me.options.time.isoWeekday);
- } else {
- return tick.clone().startOf(me.tickUnit);
}
+ return tick.clone().startOf(me.tickUnit);
},
determineDataLimits: function() {
var me = this;
if (callback) {
return callback(formattedTick, index, ticks);
- } else {
- return formattedTick;
}
+ return formattedTick;
},
convertTicksToLabels: function() {
var me = this;
var valueOffset = (innerWidth * decimal) + me.paddingLeft;
return me.left + Math.round(valueOffset);
- } else {
- var innerHeight = me.height - (me.paddingTop + me.paddingBottom);
- var heightOffset = (innerHeight * decimal) + me.paddingTop;
-
- return me.top + Math.round(heightOffset);
}
+ var innerHeight = me.height - (me.paddingTop + me.paddingBottom);
+ var heightOffset = (innerHeight * decimal) + me.paddingTop;
+
+ return me.top + Math.round(heightOffset);
}
},
getPixelForTick: function(index) {