From: etimberg Date: Wed, 21 Oct 2015 00:33:51 +0000 (-0400) Subject: Fix JSHint errors X-Git-Tag: 2.0.0-beta~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1551%2Fhead;p=thirdparty%2FChart.js.git Fix JSHint errors --- diff --git a/src/charts/Chart.Doughnut.js b/src/charts/Chart.Doughnut.js index 333a0bbeb..05a9764bd 100644 --- a/src/charts/Chart.Doughnut.js +++ b/src/charts/Chart.Doughnut.js @@ -15,6 +15,6 @@ config.type = 'doughnut'; return new Chart(context, config); - } + }; }).call(this); diff --git a/src/charts/Chart.Line.js b/src/charts/Chart.Line.js index d5e7cf76c..8e26f09b5 100644 --- a/src/charts/Chart.Line.js +++ b/src/charts/Chart.Line.js @@ -9,6 +9,6 @@ config.type = 'line'; return new Chart(context, config); - } + }; }).call(this); diff --git a/src/charts/Chart.PolarArea.js b/src/charts/Chart.PolarArea.js index 9dbdf1b39..20171f7f7 100644 --- a/src/charts/Chart.PolarArea.js +++ b/src/charts/Chart.PolarArea.js @@ -15,6 +15,6 @@ config.type = 'polarArea'; return new Chart(context, config); - } + }; }).call(this); diff --git a/src/charts/Chart.Radar.js b/src/charts/Chart.Radar.js index 2f1f82606..7680e25f7 100644 --- a/src/charts/Chart.Radar.js +++ b/src/charts/Chart.Radar.js @@ -14,6 +14,6 @@ config.type = 'radar'; return new Chart(context, config); - } + }; }).call(this); diff --git a/src/charts/Chart.Scatter.js b/src/charts/Chart.Scatter.js index 8863ed5e6..ee1ec474a 100644 --- a/src/charts/Chart.Scatter.js +++ b/src/charts/Chart.Scatter.js @@ -34,6 +34,6 @@ config.options = helpers.configMerge(defaultConfig, config.options); config.type = 'line'; return new Chart(context, config); - } + }; }).call(this); \ No newline at end of file diff --git a/src/controllers/controller.doughnut.js b/src/controllers/controller.doughnut.js index 4ab485058..1188a7c2b 100644 --- a/src/controllers/controller.doughnut.js +++ b/src/controllers/controller.doughnut.js @@ -92,7 +92,7 @@ // Make sure that we handle number of datapoints changing if (numData < numArcs) { // Remove excess bars for data points that have been removed - this.getDataset().metaData.splice(numData, numArcs - numData) + this.getDataset().metaData.splice(numData, numArcs - numData); } else if (numData > numArcs) { // Add new elements for (var index = numArcs; index < numData; ++index) { diff --git a/src/controllers/controller.polarArea.js b/src/controllers/controller.polarArea.js index 709cc1591..45e4b33a5 100644 --- a/src/controllers/controller.polarArea.js +++ b/src/controllers/controller.polarArea.js @@ -87,7 +87,7 @@ // Make sure that we handle number of datapoints changing if (numData < numPoints) { // Remove excess bars for data points that have been removed - this.getDataset().metaData.splice(numData, numPoints - numData) + this.getDataset().metaData.splice(numData, numPoints - numData); } else if (numData > numPoints) { // Add new elements for (var index = numPoints; index < numData; ++index) { @@ -206,12 +206,4 @@ }, }); - - - - return; - - - Chart.Type.extend({}); - }).call(this); diff --git a/src/controllers/controller.radar.js b/src/controllers/controller.radar.js index 40fc4a7ab..ddbff5e15 100644 --- a/src/controllers/controller.radar.js +++ b/src/controllers/controller.radar.js @@ -103,7 +103,7 @@ // Make sure that we handle number of datapoints changing if (numData < numPoints) { // Remove excess bars for data points that have been removed - this.getDataset().metaData.splice(numData, numPoints - numData) + this.getDataset().metaData.splice(numData, numPoints - numData); } else if (numData > numPoints) { // Add new elements for (var index = numPoints; index < numData; ++index) { diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 773f54319..8cb9bcd2d 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -158,7 +158,7 @@ this.scale = scale; - this.scales['radialScale'] = scale; + this.scales.radialScale = scale; } Chart.scaleService.update(this, this.chart.width, this.chart.height); @@ -313,13 +313,13 @@ helpers.each(this.data.datasets, function(dataset, datasetIndex) { if (helpers.isDatasetVisible(dataset)) { - for (var elementIndex = 0; elementIndex < dataset.metaData.length; elementIndex++) { - if (dataset.metaData[elementIndex].inLabelRange(eventPosition.x, eventPosition.y)) { + helpers.each(dataset.metaData, function(element, elementIndex) { + if (element.inLabelRange(eventPosition.x, eventPosition.y)) { helpers.each(dataset.metaData, function(element, index) { elementsArray.push(element); }, this); } - } + }, this); } }, this); @@ -428,8 +428,8 @@ break; case 'label': case 'dataset': - for (var i = 0; i < this.active.length; i++) { - this.data.datasets[this.active[i]._datasetIndex].controller.setHoverStyle(this.active[i]); + for (var j = 0; j < this.active.length; j++) { + this.data.datasets[this.active[j]._datasetIndex].controller.setHoverStyle(this.active[j]); } break; default: diff --git a/src/core/core.helpers.js b/src/core/core.helpers.js index a15b06b44..ca27c7c3c 100644 --- a/src/core/core.helpers.js +++ b/src/core/core.helpers.js @@ -135,7 +135,7 @@ base[key].push(helpers.configMerge(valueObj.type ? Chart.scaleService.getScaleDefaults(valueObj.type) : {}, valueObj)); } else if (valueObj.type !== base[key][index].type) { // Type changed. Bring in the new defaults before we bring in valueObj so that valueObj can override the correct scale defaults - base[key][index] = helpers.configMerge(base[key][index], valueObj.type ? Chart.scaleService.getScaleDefaults(valueObj.type) : {}, valueObj) + base[key][index] = helpers.configMerge(base[key][index], valueObj.type ? Chart.scaleService.getScaleDefaults(valueObj.type) : {}, valueObj); } else { // Type is the same base[key][index] = helpers.configMerge(base[key][index], valueObj); @@ -272,7 +272,7 @@ }, log10 = helpers.log10 = function(x) { if (Math.log10) { - return Math.log10(x) + return Math.log10(x); } else { return Math.log(x) / Math.LN10; } @@ -837,7 +837,7 @@ // can use classlist hiddenIframe.classlist.add(hiddenIframeClass); } else { - hiddenIframe.setAttribute('class', hiddenIframeClass) + hiddenIframe.setAttribute('class', hiddenIframeClass); } // Set the style @@ -860,7 +860,7 @@ if (callback) { callback(); } - } + }; }, removeResizeListener = helpers.removeResizeListener = function(node) { var hiddenIframe = node.querySelector('.chartjs-hidden-iframe'); diff --git a/src/core/core.scale.js b/src/core/core.scale.js index 23b5a9b70..3a1373efa 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -112,7 +112,7 @@ // Reset position before calculating rotation this.top = 0; - this.bottom = this.height + this.bottom = this.height; } // Reset padding diff --git a/src/elements/element.arc.js b/src/elements/element.arc.js index 209c505d9..615cab867 100644 --- a/src/elements/element.arc.js +++ b/src/elements/element.arc.js @@ -45,7 +45,7 @@ // Put into the range of (-PI/2, 3PI/2] var startAngle = vm.startAngle < (-0.5 * Math.PI) ? vm.startAngle + (2.0 * Math.PI) : vm.startAngle > (1.5 * Math.PI) ? vm.startAngle - (2.0 * Math.PI) : vm.startAngle; - var endAngle = vm.endAngle < (-0.5 * Math.PI) ? vm.endAngle + (2.0 * Math.PI) : vm.endAngle > (1.5 * Math.PI) ? vm.endAngle - (2.0 * Math.PI) : vm.endAngle + var endAngle = vm.endAngle < (-0.5 * Math.PI) ? vm.endAngle + (2.0 * Math.PI) : vm.endAngle > (1.5 * Math.PI) ? vm.endAngle - (2.0 * Math.PI) : vm.endAngle; //Check if within the range of the open/close angle var betweenAngles = (pointRelativePosition.angle >= startAngle && pointRelativePosition.angle <= endAngle), diff --git a/src/scales/scale.category.js b/src/scales/scale.category.js index a2e569d4c..7e572b864 100644 --- a/src/scales/scale.category.js +++ b/src/scales/scale.category.js @@ -21,23 +21,23 @@ if (this.isHorizontal()) { var innerWidth = this.width - (this.paddingLeft + this.paddingRight); var valueWidth = innerWidth / Math.max((this.data.labels.length - ((this.options.gridLines.offsetGridLines) ? 0 : 1)), 1); - var valueOffset = (valueWidth * index) + this.paddingLeft; + var widthOffset = (valueWidth * index) + this.paddingLeft; if (this.options.gridLines.offsetGridLines && includeOffset) { - valueOffset += (valueWidth / 2); + widthOffset += (valueWidth / 2); } - return this.left + Math.round(valueOffset); + return this.left + Math.round(widthOffset); } else { var innerHeight = this.height - (this.paddingTop + this.paddingBottom); var valueHeight = innerHeight / Math.max((this.data.labels.length - ((this.options.gridLines.offsetGridLines) ? 0 : 1)), 1); - var valueOffset = (valueHeight * index) + this.paddingTop; + var heightOffset = (valueHeight * index) + this.paddingTop; if (this.options.gridLines.offsetGridLines && includeOffset) { - valueOffset += (valueHeight / 2); + heightOffset += (valueHeight / 2); } - return this.top + Math.round(valueOffset); + return this.top + Math.round(heightOffset); } }, });