From: Zach Panzarino Date: Wed, 14 Sep 2016 18:05:19 +0000 (+0000) Subject: First round of eslint fixes X-Git-Tag: v2.3.0-rc.1~1^2~6^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d2f475a7a5a48f9d623de88df9314aee0d5f059;p=thirdparty%2FChart.js.git First round of eslint fixes --- diff --git a/src/charts/Chart.Bar.js b/src/charts/Chart.Bar.js index b80100c00..e1ad7962f 100644 --- a/src/charts/Chart.Bar.js +++ b/src/charts/Chart.Bar.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -8,4 +8,4 @@ module.exports = function(Chart) { return new Chart(context, config); }; -}; \ No newline at end of file +}; diff --git a/src/charts/Chart.Bubble.js b/src/charts/Chart.Bubble.js index 37f4a98bb..2de4a1047 100644 --- a/src/charts/Chart.Bubble.js +++ b/src/charts/Chart.Bubble.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -7,4 +7,4 @@ module.exports = function(Chart) { return new Chart(context, config); }; -}; \ No newline at end of file +}; diff --git a/src/charts/Chart.Doughnut.js b/src/charts/Chart.Doughnut.js index 41f80a244..e1e8ce54b 100644 --- a/src/charts/Chart.Doughnut.js +++ b/src/charts/Chart.Doughnut.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -8,4 +8,4 @@ module.exports = function(Chart) { return new Chart(context, config); }; -}; \ No newline at end of file +}; diff --git a/src/charts/Chart.Line.js b/src/charts/Chart.Line.js index ea328ac6e..e89662ff7 100644 --- a/src/charts/Chart.Line.js +++ b/src/charts/Chart.Line.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -8,4 +8,4 @@ module.exports = function(Chart) { return new Chart(context, config); }; -}; \ No newline at end of file +}; diff --git a/src/charts/Chart.PolarArea.js b/src/charts/Chart.PolarArea.js index 3a3e032f6..e07e4bac5 100644 --- a/src/charts/Chart.PolarArea.js +++ b/src/charts/Chart.PolarArea.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -8,4 +8,4 @@ module.exports = function(Chart) { return new Chart(context, config); }; -}; \ No newline at end of file +}; diff --git a/src/charts/Chart.Radar.js b/src/charts/Chart.Radar.js index 322c4544a..1648e9fac 100644 --- a/src/charts/Chart.Radar.js +++ b/src/charts/Chart.Radar.js @@ -1,9 +1,9 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { - + Chart.Radar = function(context, config) { - config.options = Chart.helpers.configMerge({ aspectRatio: 1 }, config.options); + config.options = Chart.helpers.configMerge({aspectRatio: 1}, config.options); config.type = 'radar'; return new Chart(context, config); diff --git a/src/charts/Chart.Scatter.js b/src/charts/Chart.Scatter.js index 7ab5c5717..84594f637 100644 --- a/src/charts/Chart.Scatter.js +++ b/src/charts/Chart.Scatter.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -9,14 +9,14 @@ module.exports = function(Chart) { scales: { xAxes: [{ - type: "linear", // scatter should not use a category axis - position: "bottom", - id: "x-axis-1" // need an ID so datasets can reference the scale + type: 'linear', // scatter should not use a category axis + position: 'bottom', + id: 'x-axis-1' // need an ID so datasets can reference the scale }], yAxes: [{ - type: "linear", - position: "left", - id: "y-axis-1" + type: 'linear', + position: 'left', + id: 'y-axis-1' }] }, @@ -44,4 +44,4 @@ module.exports = function(Chart) { return new Chart(context, config); }; -}; \ No newline at end of file +}; diff --git a/src/controllers/controller.bar.js b/src/controllers/controller.bar.js index 30347a28d..73ed2df2a 100644 --- a/src/controllers/controller.bar.js +++ b/src/controllers/controller.bar.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -6,12 +6,12 @@ module.exports = function(Chart) { Chart.defaults.bar = { hover: { - mode: "label" + mode: 'label' }, scales: { xAxes: [{ - type: "category", + type: 'category', // Specific to Bar Controller categoryPercentage: 0.8, @@ -23,7 +23,7 @@ module.exports = function(Chart) { } }], yAxes: [{ - type: "linear" + type: 'linear' }] } }; @@ -281,17 +281,17 @@ module.exports = function(Chart) { // it extends bar (like pie extends doughnut) Chart.defaults.horizontalBar = { hover: { - mode: "label" + mode: 'label' }, scales: { xAxes: [{ - type: "linear", - position: "bottom" + type: 'linear', + position: 'bottom' }], yAxes: [{ - position: "left", - type: "category", + position: 'left', + type: 'category', // Specific to Horizontal Bar Controller categoryPercentage: 0.8, @@ -368,7 +368,7 @@ module.exports = function(Chart) { borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth) }, - draw: function () { + draw: function() { var ctx = this._chart.ctx; var vm = this._view; @@ -425,7 +425,7 @@ module.exports = function(Chart) { } }, - inRange: function (mouseX, mouseY) { + inRange: function(mouseX, mouseY) { var vm = this._view; var inRange = false; @@ -444,7 +444,7 @@ module.exports = function(Chart) { rectangle.pivot(); }, - calculateBarBase: function (datasetIndex, index) { + calculateBarBase: function(datasetIndex, index) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); @@ -470,7 +470,7 @@ module.exports = function(Chart) { return xScale.getBasePixel(); }, - getRuler: function (index) { + getRuler: function(index) { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); @@ -506,7 +506,7 @@ module.exports = function(Chart) { }; }, - calculateBarHeight: function (index) { + calculateBarHeight: function(index) { var me = this; var yScale = me.getScaleForId(me.getMeta().yAxisID); if (yScale.options.barThickness) { @@ -516,7 +516,7 @@ module.exports = function(Chart) { return yScale.options.stacked ? ruler.categoryHeight : ruler.barHeight; }, - calculateBarX: function (index, datasetIndex) { + calculateBarX: function(index, datasetIndex) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); @@ -550,7 +550,7 @@ module.exports = function(Chart) { return xScale.getPixelForValue(value); }, - calculateBarY: function (index, datasetIndex) { + calculateBarY: function(index, datasetIndex) { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); diff --git a/src/controllers/controller.bubble.js b/src/controllers/controller.bubble.js index 49aa50078..b1c6474e0 100644 --- a/src/controllers/controller.bubble.js +++ b/src/controllers/controller.bubble.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -6,19 +6,19 @@ module.exports = function(Chart) { Chart.defaults.bubble = { hover: { - mode: "single" + mode: 'single' }, scales: { xAxes: [{ - type: "linear", // bubble should probably use a linear scale by default - position: "bottom", - id: "x-axis-0" // need an ID so datasets can reference the scale + type: 'linear', // bubble should probably use a linear scale by default + position: 'bottom', + id: 'x-axis-0' // need an ID so datasets can reference the scale }], yAxes: [{ - type: "linear", - position: "left", - id: "y-axis-0" + type: 'linear', + position: 'left', + id: 'y-axis-0' }] }, diff --git a/src/controllers/controller.doughnut.js b/src/controllers/controller.doughnut.js index 096f3085a..40d4e2c84 100644 --- a/src/controllers/controller.doughnut.js +++ b/src/controllers/controller.doughnut.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -7,9 +7,9 @@ module.exports = function(Chart) { defaults.doughnut = { animation: { - //Boolean - Whether we animate the rotation of the Doughnut + // Boolean - Whether we animate the rotation of the Doughnut animateRotate: true, - //Boolean - Whether we animate scaling the Doughnut from the centre + // Boolean - Whether we animate scaling the Doughnut from the centre animateScale: false }, aspectRatio: 1, @@ -35,7 +35,7 @@ module.exports = function(Chart) { } text.push(''); - return text.join(""); + return text.join(''); }, legend: { labels: { @@ -84,13 +84,13 @@ module.exports = function(Chart) { } }, - //The percentage of the chart that we cut out of the middle. + // The percentage of the chart that we cut out of the middle. cutoutPercentage: 50, - //The rotation of the chart, where the first data arc begins. + // The rotation of the chart, where the first data arc begins. rotation: Math.PI * -0.5, - //The total circumference of the chart. + // The total circumference of the chart. circumference: Math.PI * 2.0, // Need to override these to give a nice default @@ -253,7 +253,7 @@ module.exports = function(Chart) { } }); - /*if (total === 0) { + /* if (total === 0) { total = NaN; }*/ @@ -269,8 +269,8 @@ module.exports = function(Chart) { } }, - //gets the max border or hover width to properly scale pie charts - getMaxBorderWidth: function (elements) { + // gets the max border or hover width to properly scale pie charts + getMaxBorderWidth: function(elements) { var max = 0, index = this.index, length = elements.length, diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 53d3f38e6..a516a1e36 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -9,16 +9,16 @@ module.exports = function(Chart) { spanGaps: false, hover: { - mode: "label" + mode: 'label' }, scales: { xAxes: [{ - type: "category", + type: 'category', id: 'x-axis-0' }], yAxes: [{ - type: "linear", + type: 'linear', id: 'y-axis-0' }] } diff --git a/src/controllers/controller.polarArea.js b/src/controllers/controller.polarArea.js index 987054624..6a11b4599 100644 --- a/src/controllers/controller.polarArea.js +++ b/src/controllers/controller.polarArea.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -7,14 +7,14 @@ module.exports = function(Chart) { Chart.defaults.polarArea = { scale: { - type: "radialLinear", + type: 'radialLinear', lineArc: true, // so that lines are circular ticks: { beginAtZero: true } }, - //Boolean - Whether to animate the rotation of the chart + // Boolean - Whether to animate the rotation of the chart animation: { animateRotate: true, animateScale: true @@ -41,7 +41,7 @@ module.exports = function(Chart) { } text.push(''); - return text.join(""); + return text.join(''); }, legend: { labels: { @@ -155,7 +155,7 @@ module.exports = function(Chart) { } } - //var negHalfPI = -0.5 * Math.PI; + // var negHalfPI = -0.5 * Math.PI; var datasetStartAngle = opts.startAngle; var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]); var startAngle = datasetStartAngle + (circumference * visibleCount); diff --git a/src/controllers/controller.radar.js b/src/controllers/controller.radar.js index bc963b868..3c050595a 100644 --- a/src/controllers/controller.radar.js +++ b/src/controllers/controller.radar.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -6,7 +6,7 @@ module.exports = function(Chart) { Chart.defaults.radar = { scale: { - type: "radialLinear" + type: 'radialLinear' }, elements: { line: { diff --git a/src/core/core.animation.js b/src/core/core.animation.js index 17c0f6597..7ccb37493 100644 --- a/src/core/core.animation.js +++ b/src/core/core.animation.js @@ -1,5 +1,5 @@ -/*global window: false */ -"use strict"; +/* global window: false */ +'use strict'; module.exports = function(Chart) { @@ -7,7 +7,7 @@ module.exports = function(Chart) { Chart.defaults.global.animation = { duration: 1000, - easing: "easeOutQuart", + easing: 'easeOutQuart', onProgress: helpers.noop, onComplete: helpers.noop }; @@ -15,7 +15,7 @@ module.exports = function(Chart) { Chart.Animation = Chart.Element.extend({ currentStep: null, // the current animation step numSteps: 60, // default number of steps - easing: "", // the easing to use for this animation + easing: '', // the easing to use for this animation render: null, // render function used by the animation service onAnimationProgress: null, // user specified callback to fire on each step of the animation @@ -128,4 +128,4 @@ module.exports = function(Chart) { } } }; -}; \ No newline at end of file +}; diff --git a/src/core/core.canvasHelpers.js b/src/core/core.canvasHelpers.js index f8c35c96e..439df7dba 100644 --- a/src/core/core.canvasHelpers.js +++ b/src/core/core.canvasHelpers.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { // Global Chart canvas helpers object for drawing items to canvas @@ -40,7 +40,7 @@ module.exports = function(Chart) { case 'rect': size = 1 / Math.SQRT2 * radius; ctx.beginPath(); - ctx.fillRect(x - size, y - size, 2 * size, 2 * size); + ctx.fillRect(x - size, y - size, 2 * size, 2 * size); ctx.strokeRect(x - size, y - size, 2 * size, 2 * size); break; case 'rectRot': @@ -101,4 +101,4 @@ module.exports = function(Chart) { ctx.stroke(); }; -}; \ No newline at end of file +}; diff --git a/src/core/core.controller.js b/src/core/core.controller.js index dc9940076..f996fa2b5 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -1,13 +1,13 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { var helpers = Chart.helpers; - //Create a dictionary of chart types, to allow for extension of existing types + // Create a dictionary of chart types, to allow for extension of existing types Chart.types = {}; - //Store a reference to each instance - allowing us to globally resize chart instances on window resize. - //Destroy method on the chart will remove the instance of the chart from this reference. + // Store a reference to each instance - allowing us to globally resize chart instances on window resize. + // Destroy method on the chart will remove the instance of the chart from this reference. Chart.instances = {}; // Controllers available for dataset visualization eg. bar, line, slice, etc. @@ -30,7 +30,7 @@ module.exports = function(Chart) { } }); - //Add the chart instance to the global namespace + // Add the chart instance to the global namespace Chart.instances[this.id] = this; if (this.options.responsive) { @@ -99,7 +99,7 @@ module.exports = function(Chart) { helpers.retinaScale(chart); // Notify any plugins about the resize - var newSize = { width: newWidth, height: newHeight }; + var newSize = {width: newWidth, height: newHeight}; Chart.plugins.notify('resize', [me, newSize]); // Notify of resize @@ -145,13 +145,13 @@ module.exports = function(Chart) { 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) { - items.push({ options: options.scale, dtype: 'radialLinear', isDefault: true }); + items.push({options: options.scale, dtype: 'radialLinear', isDefault: true}); } helpers.each(items, function(item) { @@ -291,12 +291,12 @@ module.exports = function(Chart) { var me = this; var i, ilen; - if (Chart.plugins.notify('beforeDatasetsUpdate', [ me ])) { + if (Chart.plugins.notify('beforeDatasetsUpdate', [me])) { for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) { me.getDatasetMeta(i).controller.update(); } - Chart.plugins.notify('afterDatasetsUpdate', [ me ]); + Chart.plugins.notify('afterDatasetsUpdate', [me]); } }, @@ -307,7 +307,7 @@ module.exports = function(Chart) { var animationOptions = me.options.animation; if (animationOptions && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && animationOptions.duration !== 0))) { var animation = new Chart.Animation(); - animation.numSteps = (duration || animationOptions.duration) / 16.66; //60 fps + animation.numSteps = (duration || animationOptions.duration) / 16.66; // 60 fps animation.easing = animationOptions.easing; // render function @@ -392,7 +392,7 @@ module.exports = function(Chart) { var eventPosition = helpers.getRelativePosition(e, me.chart); var elementsArray = []; - var found = (function() { + var found = function() { if (me.data.datasets) { for (var i = 0; i < me.data.datasets.length; i++) { var meta = me.getDatasetMeta(i); @@ -405,7 +405,7 @@ module.exports = function(Chart) { } } } - }).call(me); + }.call(me); if (!found) { return elementsArray; @@ -415,7 +415,7 @@ module.exports = function(Chart) { if (me.isDatasetVisible(datasetIndex)) { var meta = me.getDatasetMeta(datasetIndex), element = meta.data[found._index]; - if(element && !element._view.skip){ + if(element && !element._view.skip) { elementsArray.push(element); } } @@ -429,7 +429,7 @@ module.exports = function(Chart) { var eventPosition = helpers.getRelativePosition(e, me.chart); var elementsArray = []; - var found = (function() { + var found = function() { if (me.data.datasets) { for (var i = 0; i < me.data.datasets.length; i++) { var meta = me.getDatasetMeta(i); @@ -442,7 +442,7 @@ module.exports = function(Chart) { } } } - }).call(me); + }.call(me); if (!found) { return elementsArray; @@ -451,7 +451,7 @@ module.exports = function(Chart) { helpers.each(me.data.datasets, function(dataset, datasetIndex) { if (me.isDatasetVisible(datasetIndex)) { var meta = me.getDatasetMeta(datasetIndex); - var index = helpers.findIndex(meta.data, function (it) { + var index = helpers.findIndex(meta.data, function(it) { return found._model.x === it._model.x; }); if(index !== -1 && !meta.data[index]._view.skip) { @@ -587,7 +587,7 @@ module.exports = function(Chart) { switch (mode) { case 'single': - elements = [ elements[0] ]; + elements = [elements[0]]; break; case 'label': case 'dataset': @@ -623,7 +623,7 @@ module.exports = function(Chart) { me.tooltipActive = []; } else { me.active = me.getElementsAtEventForMode(e, hoverOptions.mode); - me.tooltipActive = me.getElementsAtEventForMode(e, tooltipsOptions.mode); + me.tooltipActive = me.getElementsAtEventForMode(e, tooltipsOptions.mode); } // On Hover hook diff --git a/src/core/core.datasetController.js b/src/core/core.datasetController.js index bc140800d..29b1aacea 100644 --- a/src/core/core.datasetController.js +++ b/src/core/core.datasetController.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -161,4 +161,4 @@ module.exports = function(Chart) { }); Chart.DatasetController.extend = helpers.inherits; -}; \ No newline at end of file +}; diff --git a/src/core/core.element.js b/src/core/core.element.js index e385074ae..14c6dbad2 100644 --- a/src/core/core.element.js +++ b/src/core/core.element.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { diff --git a/src/core/core.helpers.js b/src/core/core.helpers.js index 2c69adcd5..9c021a780 100644 --- a/src/core/core.helpers.js +++ b/src/core/core.helpers.js @@ -1,14 +1,14 @@ -/*global window: false */ -/*global document: false */ -"use strict"; +/* global window: false */ +/* global document: false */ +'use strict'; var color = require('chartjs-color'); module.exports = function(Chart) { - //Global Chart helpers object for utility methods and classes + // Global Chart helpers object for utility methods and classes var helpers = Chart.helpers = {}; - //-- Basic js utility methods + // -- Basic js utility methods helpers.each = function(loopable, callback, self, reverse) { // Check to see if null or undefined firstly. var i, len; @@ -83,7 +83,7 @@ module.exports = function(Chart) { } }); - } else if (base.hasOwnProperty(key) && typeof base[key] === "object" && base[key] !== null && typeof value === "object") { + } else if (base.hasOwnProperty(key) && typeof base[key] === 'object' && base[key] !== null && typeof value === 'object') { // If we are overwriting an object with an object, do a merge of the properties. base[key] = helpers.configMerge(base[key], value); @@ -123,7 +123,7 @@ module.exports = function(Chart) { base[key].push(helpers.configMerge(Chart.scaleService.getScaleDefaults(axisType), valueObj)); }); } - } else if (base.hasOwnProperty(key) && typeof base[key] === "object" && base[key] !== null && typeof value === "object") { + } else if (base.hasOwnProperty(key) && typeof base[key] === 'object' && base[key] !== null && typeof value === 'object') { // If we are overwriting an object with an object, do a merge of the properties. base[key] = helpers.configMerge(base[key], value); @@ -210,9 +210,9 @@ module.exports = function(Chart) { } }; helpers.inherits = function(extensions) { - //Basic javascript inheritance based on the model created in Backbone.js + // Basic javascript inheritance based on the model created in Backbone.js var parent = this; - var ChartElement = (extensions && extensions.hasOwnProperty("constructor")) ? extensions.constructor : function() { + var ChartElement = (extensions && extensions.hasOwnProperty('constructor')) ? extensions.constructor : function() { return parent.apply(this, arguments); }; @@ -239,7 +239,7 @@ module.exports = function(Chart) { return id++; }; }()); - //-- Math methods + // -- Math methods helpers.isNumber = function(n) { return !isNaN(parseFloat(n)) && isFinite(n); }; @@ -305,8 +305,8 @@ module.exports = function(Chart) { return (pixelWidth % 2 === 0) ? 0 : 0.5; }; helpers.splineCurve = function(firstPoint, middlePoint, afterPoint, t) { - //Props to Rob Spencer at scaled innovation for his post on splining between points - //http://scaledinnovation.com/analytics/splines/aboutSplines.html + // Props to Rob Spencer at scaled innovation for his post on splining between points + // http://scaledinnovation.com/analytics/splines/aboutSplines.html // This function must also respect "skipped" points @@ -402,7 +402,7 @@ module.exports = function(Chart) { tauK = 3 / Math.sqrt(squaredMagnitude); pointCurrent.mK = alphaK * tauK * pointCurrent.deltaK; - pointAfter.mK = betaK * tauK * pointCurrent.deltaK; + pointAfter.mK = betaK * tauK * pointCurrent.deltaK; } // Compute control points @@ -469,8 +469,8 @@ module.exports = function(Chart) { return niceFraction * Math.pow(10, exponent); }; - //Easing functions adapted from Robert Penner's easing equations - //http://www.robertpenner.com/easing/ + // Easing functions adapted from Robert Penner's easing equations + // http://www.robertpenner.com/easing/ var easingEffects = helpers.easingEffects = { linear: function(t) { return t; @@ -667,7 +667,7 @@ module.exports = function(Chart) { return easingEffects.easeOutBounce(t * 2 - 1) * 0.5 + 1 * 0.5; } }; - //Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ + // Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ helpers.requestAnimFrame = (function() { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || @@ -688,7 +688,7 @@ module.exports = function(Chart) { return window.clearTimeout(callback, 1000 / 60); }; }()); - //-- DOM methods + // -- DOM methods helpers.getRelativePosition = function(evt, chart) { var mouseX, mouseY; var e = evt.originalEvent || evt, @@ -730,18 +730,18 @@ module.exports = function(Chart) { if (node.addEventListener) { node.addEventListener(eventType, method); } else if (node.attachEvent) { - node.attachEvent("on" + eventType, method); + node.attachEvent('on' + eventType, method); } else { - node["on" + eventType] = method; + node['on' + eventType] = method; } }; helpers.removeEvent = function(node, eventType, handler) { if (node.removeEventListener) { node.removeEventListener(eventType, handler, false); } else if (node.detachEvent) { - node.detachEvent("on" + eventType, handler); + node.detachEvent('on' + eventType, handler); } else { - node["on" + eventType] = helpers.noop; + node['on' + eventType] = helpers.noop; } }; helpers.bindEvents = function(chartInstance, arrayOfEvents, handler) { @@ -784,7 +784,7 @@ module.exports = function(Chart) { * @private */ function isConstrainedValue(value) { - return value !== undefined && value !== null && value !== 'none'; + return value !== undefined && value !== null && value !== 'none'; } // Private helper to get a constraint dimension @@ -859,12 +859,12 @@ module.exports = function(Chart) { canvas.style.width = width + 'px'; canvas.style.height = height + 'px'; }; - //-- Canvas methods + // -- Canvas methods helpers.clear = function(chart) { chart.ctx.clearRect(0, 0, chart.width, chart.height); }; helpers.fontString = function(pixelSize, fontStyle, fontFamily) { - return fontStyle + " " + pixelSize + "px " + fontFamily; + return fontStyle + ' ' + pixelSize + 'px ' + fontFamily; }; helpers.longestText = function(ctx, font, arrayOfThings, cache) { cache = cache || {}; @@ -904,7 +904,7 @@ module.exports = function(Chart) { } return longest; }; - helpers.measureText = function (ctx, data, gc, longest, string) { + helpers.measureText = function(ctx, data, gc, longest, string) { var textWidth = data[string]; if (!textWidth) { textWidth = data[string] = ctx.measureText(string).width; @@ -1000,7 +1000,7 @@ module.exports = function(Chart) { function(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; }; - //! @see http://stackoverflow.com/a/14853974 + // ! @see http://stackoverflow.com/a/14853974 helpers.arrayEquals = function(a0, a1) { var i, ilen, v0, v1; diff --git a/src/core/core.js b/src/core/core.js index 9000dbd22..c4f65e5ca 100755 --- a/src/core/core.js +++ b/src/core/core.js @@ -1,12 +1,12 @@ -"use strict"; +'use strict'; module.exports = function() { - //Occupy the global variable of Chart, and create a simple base class + // Occupy the global variable of Chart, and create a simple base class var Chart = function(context, config) { var me = this; var helpers = Chart.helpers; - me.config = config || { + me.config = config || { data: { datasets: [] } @@ -19,7 +19,7 @@ module.exports = function() { // Support a canvas domnode if (context.getContext) { - context = context.getContext("2d"); + context = context.getContext('2d'); } me.ctx = context; @@ -62,13 +62,13 @@ module.exports = function() { }; - //Globally expose the defaults to allow for user updating/changing + // Globally expose the defaults to allow for user updating/changing Chart.defaults = { global: { responsive: true, responsiveAnimationDuration: 0, maintainAspectRatio: true, - events: ["mousemove", "mouseout", "click", "touchstart", "touchmove"], + events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'], hover: { onHover: null, mode: 'single', @@ -77,7 +77,7 @@ module.exports = function() { onClick: null, defaultColor: 'rgba(0,0,0,0.1)', defaultFontColor: '#666', - defaultFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + defaultFontFamily: '\'Helvetica Neue\', \'Helvetica\', \'Arial\', sans-serif', defaultFontSize: 12, defaultFontStyle: 'normal', showLines: true, @@ -98,7 +98,7 @@ module.exports = function() { } text.push(''); - return text.join(""); + return text.join(''); } } }; diff --git a/src/core/core.layoutService.js b/src/core/core.layoutService.js index 6e649b13a..324e93f5f 100644 --- a/src/core/core.layoutService.js +++ b/src/core/core.layoutService.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -36,21 +36,21 @@ module.exports = function(Chart) { var yPadding = 0; var leftBoxes = helpers.where(chartInstance.boxes, function(box) { - return box.options.position === "left"; + return box.options.position === 'left'; }); var rightBoxes = helpers.where(chartInstance.boxes, function(box) { - return box.options.position === "right"; + return box.options.position === 'right'; }); var topBoxes = helpers.where(chartInstance.boxes, function(box) { - return box.options.position === "top"; + return box.options.position === 'top'; }); var bottomBoxes = helpers.where(chartInstance.boxes, function(box) { - return box.options.position === "bottom"; + return box.options.position === 'bottom'; }); // Boxes that overlay the chartarea such as the radialLinear scale var chartAreaBoxes = helpers.where(chartInstance.boxes, function(box) { - return box.options.position === "chartArea"; + return box.options.position === 'chartArea'; }); // Ensure that full width boxes are at the very top / bottom diff --git a/src/core/core.legend.js b/src/core/core.legend.js index 7691cab22..7c78dc1ce 100644 --- a/src/core/core.legend.js +++ b/src/core/core.legend.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -151,7 +151,7 @@ module.exports = function(Chart) { buildLabels: function() { var me = this; me.legendItems = me.options.labels.generateLabels.call(me, me.chart); - if(me.options.reverse){ + if(me.options.reverse) { me.legendItems.reverse(); } }, @@ -200,7 +200,7 @@ module.exports = function(Chart) { var lineWidths = me.lineWidths = [0]; var totalHeight = me.legendItems.length ? fontSize + (labelOpts.padding) : 0; - ctx.textAlign = "left"; + ctx.textAlign = 'left'; ctx.textBaseline = 'top'; helpers.each(me.legendItems, function(legendItem, i) { @@ -277,7 +277,7 @@ module.exports = function(Chart) { // Shared Methods isHorizontal: function() { - return this.options.position === "top" || this.options.position === "bottom"; + return this.options.position === 'top' || this.options.position === 'bottom'; }, // Actualy draw the legend on the canvas @@ -301,7 +301,7 @@ module.exports = function(Chart) { labelFont = helpers.fontString(fontSize, fontStyle, fontFamily); // Canvas setup - ctx.textAlign = "left"; + ctx.textAlign = 'left'; ctx.textBaseline = 'top'; ctx.lineWidth = 0.5; ctx.strokeStyle = fontColor; // for strikethrough effect diff --git a/src/core/core.plugin.js b/src/core/core.plugin.js index d6f95c4d1..b675fbe31 100644 --- a/src/core/core.plugin.js +++ b/src/core/core.plugin.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { diff --git a/src/core/core.scale.js b/src/core/core.scale.js index 8faa49ef5..7a5613c0f 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -6,19 +6,19 @@ module.exports = function(Chart) { Chart.defaults.scale = { display: true, - position: "left", + position: 'left', // grid line settings gridLines: { display: true, - color: "rgba(0, 0, 0, 0.1)", + color: 'rgba(0, 0, 0, 0.1)', lineWidth: 1, drawBorder: true, drawOnChartArea: true, drawTicks: true, tickMarkLength: 10, zeroLineWidth: 1, - zeroLineColor: "rgba(0,0,0,0.25)", + zeroLineColor: 'rgba(0,0,0,0.25)', offsetGridLines: false, borderDash: [], borderDashOffset: 0.0 @@ -192,8 +192,8 @@ module.exports = function(Chart) { var globalDefaults = Chart.defaults.global; var optionTicks = me.options.ticks; - //Get the width of each grid by calculating the difference - //between x offsets between 0 and 1. + // Get the width of each grid by calculating the difference + // between x offsets between 0 and 1. var tickFontSize = helpers.getValueOrDefault(optionTicks.fontSize, globalDefaults.defaultFontSize); var tickFontStyle = helpers.getValueOrDefault(optionTicks.fontStyle, globalDefaults.defaultFontStyle); var tickFontFamily = helpers.getValueOrDefault(optionTicks.fontFamily, globalDefaults.defaultFontFamily); @@ -225,7 +225,7 @@ module.exports = function(Chart) { // only the index matters for a dataset scale, but we want a consistent interface between scales var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6; - //Max label rotation can be set or default to 90 - also act as a loop counter + // Max label rotation can be set or default to 90 - also act as a loop counter while (labelWidth > tickWidth && me.labelRotation < optionTicks.maxRotation) { cosRotation = Math.cos(helpers.toRadians(me.labelRotation)); sinRotation = Math.sin(helpers.toRadians(me.labelRotation)); @@ -386,7 +386,7 @@ module.exports = function(Chart) { // Shared Methods isHorizontal: function() { - return this.options.position === "top" || this.options.position === "bottom"; + return this.options.position === 'top' || this.options.position === 'bottom'; }, isFullWidth: function() { return (this.options.fullWidth); @@ -403,7 +403,7 @@ module.exports = function(Chart) { return NaN; } // If it is in fact an object, dive in one more level - if (typeof(rawValue) === "object") { + if (typeof(rawValue) === 'object') { if ((rawValue instanceof Date) || (rawValue.isValid)) { return rawValue; } else { @@ -447,7 +447,7 @@ module.exports = function(Chart) { }, // Utility for getting the pixel location of a percentage of scale - getPixelForDecimal: function(decimal /*, includeOffset*/ ) { + getPixelForDecimal: function(decimal /* , includeOffset*/) { var me = this; if (me.isHorizontal()) { var innerWidth = me.width - (me.paddingLeft + me.paddingRight); @@ -553,10 +553,10 @@ module.exports = function(Chart) { } - var xTickStart = options.position === "right" ? me.left : me.right - tl; - var xTickEnd = options.position === "right" ? me.left + tl : me.right; - var yTickStart = options.position === "bottom" ? me.top : me.bottom - tl; - var yTickEnd = options.position === "bottom" ? me.top + tl : me.bottom; + var xTickStart = options.position === 'right' ? me.left : me.right - tl; + var xTickEnd = options.position === 'right' ? me.left + tl : me.right; + var yTickStart = options.position === 'bottom' ? me.top : me.bottom - tl; + var yTickEnd = options.position === 'bottom' ? me.top + tl : me.bottom; helpers.each(me.ticks, function(label, index) { // If the callback returned a null or undefined value, do not draw this line @@ -577,7 +577,7 @@ module.exports = function(Chart) { // Draw the first index specially lineWidth = gridLines.zeroLineWidth; lineColor = gridLines.zeroLineColor; - } else { + } else { lineWidth = helpers.getValueAtIndexOrDefault(gridLines.lineWidth, index); lineColor = helpers.getValueAtIndexOrDefault(gridLines.color, index); } diff --git a/src/core/core.scaleService.js b/src/core/core.scaleService.js index 7c351e5d2..81a950790 100644 --- a/src/core/core.scaleService.js +++ b/src/core/core.scaleService.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -37,4 +37,4 @@ module.exports = function(Chart) { }); } }; -}; \ No newline at end of file +}; diff --git a/src/core/core.title.js b/src/core/core.title.js index 25abad2a7..0a8c1a5aa 100644 --- a/src/core/core.title.js +++ b/src/core/core.title.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -30,7 +30,7 @@ module.exports = function(Chart) { // These methods are ordered by lifecyle. Utilities then follow. - beforeUpdate: function () { + beforeUpdate: function() { var chartOpts = this.chart.options; if (chartOpts && chartOpts.title) { this.options = helpers.configMerge(Chart.defaults.global.title, chartOpts.title); @@ -136,7 +136,7 @@ module.exports = function(Chart) { // Shared Methods isHorizontal: function() { var pos = this.options.position; - return pos === "top" || pos === "bottom"; + return pos === 'top' || pos === 'bottom'; }, // Actualy draw the title block on the canvas diff --git a/src/core/core.tooltip.js b/src/core/core.tooltip.js index 8da2fa44e..e59b26a2d 100755 --- a/src/core/core.tooltip.js +++ b/src/core/core.tooltip.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -8,24 +8,24 @@ module.exports = function(Chart) { enabled: true, custom: null, mode: 'single', - backgroundColor: "rgba(0,0,0,0.8)", - titleFontStyle: "bold", + backgroundColor: 'rgba(0,0,0,0.8)', + titleFontStyle: 'bold', titleSpacing: 2, titleMarginBottom: 6, - titleFontColor: "#fff", - titleAlign: "left", + titleFontColor: '#fff', + titleAlign: 'left', bodySpacing: 2, - bodyFontColor: "#fff", - bodyAlign: "left", - footerFontStyle: "bold", + bodyFontColor: '#fff', + bodyAlign: 'left', + footerFontStyle: 'bold', footerSpacing: 2, footerMarginTop: 6, - footerFontColor: "#fff", - footerAlign: "left", + footerFontColor: '#fff', + footerAlign: 'left', yPadding: 6, xPadding: 6, - yAlign : 'center', - xAlign : 'center', + yAlign: 'center', + xAlign: 'center', caretSize: 5, cornerRadius: 6, multiKeyBackground: '#fff', @@ -86,7 +86,7 @@ module.exports = function(Chart) { function pushOrConcat(base, toPush) { if (toPush) { if (helpers.isArray(toPush)) { - //base = base.concat(toPush); + // base = base.concat(toPush); Array.prototype.push.apply(base, toPush); } else { base.push(toPush); @@ -107,7 +107,7 @@ module.exports = function(Chart) { for (i = 0, len = elements.length; i < len; ++i) { var el = elements[i]; - if (el && el.hasValue()){ + if (el && el.hasValue()) { var pos = el.tooltipPosition(); xPositions.push(pos.x); yPositions.push(pos.y); @@ -117,7 +117,7 @@ module.exports = function(Chart) { var x = 0, y = 0; for (i = 0; i < xPositions.length; ++i) { - if (xPositions[ i ]) { + if (xPositions[i]) { x += xPositions[i]; y += yPositions[i]; } @@ -158,8 +158,8 @@ module.exports = function(Chart) { // Positioning xPadding: tooltipOpts.xPadding, yPadding: tooltipOpts.yPadding, - xAlign : tooltipOpts.xAlign, - yAlign : tooltipOpts.yAlign, + xAlign: tooltipOpts.xAlign, + yAlign: tooltipOpts.yAlign, // Body bodyFontColor: tooltipOpts.bodyFontColor, @@ -292,8 +292,8 @@ module.exports = function(Chart) { // If the user provided a sorting function, use it to modify the tooltip items if (opts.itemSort) { - tooltipItems = tooltipItems.sort(function(a,b) { - return opts.itemSort(a,b, data); + tooltipItems = tooltipItems.sort(function(a, b) { + return opts.itemSort(a, b, data); }); } @@ -571,7 +571,7 @@ module.exports = function(Chart) { if (title.length) { ctx.textAlign = vm._titleAlign; - ctx.textBaseline = "top"; + ctx.textBaseline = 'top'; var titleFontSize = vm.titleFontSize, titleSpacing = vm.titleSpacing; @@ -597,7 +597,7 @@ module.exports = function(Chart) { var body = vm.body; ctx.textAlign = vm._bodyAlign; - ctx.textBaseline = "top"; + ctx.textBaseline = 'top'; var bodyFontColor = helpers.color(vm.bodyFontColor); var textColor = bodyFontColor.alpha(opacity * bodyFontColor.alpha()).rgbString(); @@ -659,7 +659,7 @@ module.exports = function(Chart) { pt.y += vm.footerMarginTop; ctx.textAlign = vm._footerAlign; - ctx.textBaseline = "top"; + ctx.textBaseline = 'top'; var footerFontColor = helpers.color(vm.footerFontColor); ctx.fillStyle = footerFontColor.alpha(opacity * footerFontColor.alpha()).rgbString(); diff --git a/src/elements/element.arc.js b/src/elements/element.arc.js index 64d960483..6056e8477 100644 --- a/src/elements/element.arc.js +++ b/src/elements/element.arc.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -7,7 +7,7 @@ module.exports = function(Chart) { globalOpts.elements.arc = { backgroundColor: globalOpts.defaultColor, - borderColor: "#fff", + borderColor: '#fff', borderWidth: 2 }; @@ -32,7 +32,7 @@ module.exports = function(Chart) { angle = pointRelativePosition.angle, distance = pointRelativePosition.distance; - //Sanitise angle range + // Sanitise angle range var startAngle = vm.startAngle; var endAngle = vm.endAngle; while (endAngle < startAngle) { @@ -45,7 +45,7 @@ module.exports = function(Chart) { angle += 2.0 * Math.PI; } - //Check if within the range of the open/close angle + // Check if within the range of the open/close angle var betweenAngles = (angle >= startAngle && angle <= endAngle), withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius); diff --git a/src/elements/element.line.js b/src/elements/element.line.js index 2267fef67..6ce178fbd 100644 --- a/src/elements/element.line.js +++ b/src/elements/element.line.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -34,7 +34,7 @@ module.exports = function(Chart) { var vm = 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(point._view.x, point._view.y); } else if (point._view.tension === 0) { ctx.lineTo(vm.x, vm.y); } else { @@ -94,7 +94,7 @@ module.exports = function(Chart) { } } else { if (lastDrawnIndex !== (index - 1)) { - // There was a gap and this is the first point after the gap. If we've never drawn a point, this is a special case. + // There was a gap and this is the first point after the gap. If we've never drawn a point, this is a special case. // If the first data point is NaN, then there is no real gap to skip if (spanGaps && lastDrawnIndex !== -1) { // We are spanning the gap, so simple draw a line to this point @@ -174,4 +174,4 @@ module.exports = function(Chart) { ctx.restore(); } }); -}; \ No newline at end of file +}; diff --git a/src/elements/element.point.js b/src/elements/element.point.js index 4131f8ced..474ef252f 100644 --- a/src/elements/element.point.js +++ b/src/elements/element.point.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { diff --git a/src/elements/element.rectangle.js b/src/elements/element.rectangle.js index dd252a76c..6752228c8 100644 --- a/src/elements/element.rectangle.js +++ b/src/elements/element.rectangle.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -92,4 +92,4 @@ module.exports = function(Chart) { } }); -}; \ No newline at end of file +}; diff --git a/src/scales/scale.category.js b/src/scales/scale.category.js index 6d9c33b64..4979f193e 100644 --- a/src/scales/scale.category.js +++ b/src/scales/scale.category.js @@ -1,11 +1,11 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { var helpers = Chart.helpers; // Default config for a category scale var defaultConfig = { - position: "bottom" + position: 'bottom' }; var DatasetScale = Chart.Scale.extend({ @@ -126,6 +126,6 @@ module.exports = function(Chart) { } }); - Chart.scaleService.registerScaleType("category", DatasetScale, defaultConfig); + Chart.scaleService.registerScaleType('category', DatasetScale, defaultConfig); -}; \ No newline at end of file +}; diff --git a/src/scales/scale.linear.js b/src/scales/scale.linear.js index 2c19f71a7..33a3e4930 100644 --- a/src/scales/scale.linear.js +++ b/src/scales/scale.linear.js @@ -1,11 +1,11 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { var helpers = Chart.helpers; var defaultConfig = { - position: "left", + position: 'left', ticks: { callback: function(tickValue, index, ticks) { // If we have lots of ticks, don't use the ones @@ -194,6 +194,6 @@ module.exports = function(Chart) { return this.getPixelForValue(this.ticksAsNumbers[index]); } }); - Chart.scaleService.registerScaleType("linear", LinearScale, defaultConfig); + Chart.scaleService.registerScaleType('linear', LinearScale, defaultConfig); -}; \ No newline at end of file +}; diff --git a/src/scales/scale.linearbase.js b/src/scales/scale.linearbase.js index e9e8cefa6..37caa0359 100644 --- a/src/scales/scale.linearbase.js +++ b/src/scales/scale.linearbase.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -122,4 +122,4 @@ module.exports = function(Chart) { Chart.Scale.prototype.convertTicksToLabels.call(me); } }); -}; \ No newline at end of file +}; diff --git a/src/scales/scale.logarithmic.js b/src/scales/scale.logarithmic.js index fe3e44c4f..2535deaa6 100644 --- a/src/scales/scale.logarithmic.js +++ b/src/scales/scale.logarithmic.js @@ -1,18 +1,18 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { var helpers = Chart.helpers; var defaultConfig = { - position: "left", + position: 'left', // label settings ticks: { callback: function(value, index, arr) { var remain = value / (Math.pow(10, Math.floor(helpers.log10(value)))); - if (value === 0){ + if (value === 0) { return '0'; } else if (remain === 1 || remain === 2 || remain === 5 || index === 0 || index === arr.length - 1) { return value.toExponential(); @@ -144,7 +144,7 @@ module.exports = function(Chart) { var exp; var significand; - if(tickVal === 0){ + if(tickVal === 0) { exp = Math.floor(helpers.log10(me.minNotZero)); significand = Math.round(me.minNotZero / Math.pow(10, exp)); } else { @@ -221,20 +221,20 @@ module.exports = function(Chart) { } else { // Bottom - top since pixels increase downard on a screen innerDimension = me.height - (paddingTop + paddingBottom); - if(start === 0 && !tickOpts.reverse){ + if(start === 0 && !tickOpts.reverse) { range = helpers.log10(me.end) - helpers.log10(me.minNotZero); if (newVal === start) { pixel = me.bottom - paddingBottom; - } else if(newVal === me.minNotZero){ + } else if(newVal === me.minNotZero) { pixel = me.bottom - paddingBottom - innerDimension * 0.02; } else { pixel = me.bottom - paddingBottom - innerDimension * 0.02 - (innerDimension * 0.98/ range * (helpers.log10(newVal)-helpers.log10(me.minNotZero))); } - } else if (me.end === 0 && tickOpts.reverse){ + } else if (me.end === 0 && tickOpts.reverse) { range = helpers.log10(me.start) - helpers.log10(me.minNotZero); if (newVal === me.end) { pixel = me.top + paddingTop; - } else if(newVal === me.minNotZero){ + } else if(newVal === me.minNotZero) { pixel = me.top + paddingTop + innerDimension * 0.02; } else { pixel = me.top + paddingTop + innerDimension * 0.02 + (innerDimension * 0.98/ range * (helpers.log10(newVal)-helpers.log10(me.minNotZero))); @@ -262,6 +262,6 @@ module.exports = function(Chart) { return value; } }); - Chart.scaleService.registerScaleType("logarithmic", LogarithmicScale, defaultConfig); + Chart.scaleService.registerScaleType('logarithmic', LogarithmicScale, defaultConfig); -}; \ No newline at end of file +}; diff --git a/src/scales/scale.radialLinear.js b/src/scales/scale.radialLinear.js index d0cb7f2c6..d6eef1c04 100644 --- a/src/scales/scale.radialLinear.js +++ b/src/scales/scale.radialLinear.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function(Chart) { @@ -8,37 +8,37 @@ module.exports = function(Chart) { var defaultConfig = { display: true, - //Boolean - Whether to animate scaling the chart from the centre + // Boolean - Whether to animate scaling the chart from the centre animate: true, lineArc: false, - position: "chartArea", + position: 'chartArea', angleLines: { display: true, - color: "rgba(0, 0, 0, 0.1)", + color: 'rgba(0, 0, 0, 0.1)', lineWidth: 1 }, // label settings ticks: { - //Boolean - Show a backdrop to the scale label + // Boolean - Show a backdrop to the scale label showLabelBackdrop: true, - //String - The colour of the label backdrop - backdropColor: "rgba(255,255,255,0.75)", + // String - The colour of the label backdrop + backdropColor: 'rgba(255,255,255,0.75)', - //Number - The backdrop padding above & below the label in pixels + // Number - The backdrop padding above & below the label in pixels backdropPaddingY: 2, - //Number - The backdrop padding to the side of the label in pixels + // Number - The backdrop padding to the side of the label in pixels backdropPaddingX: 2 }, pointLabels: { - //Number - Point label font size in pixels + // Number - Point label font size in pixels fontSize: 10, - //Function - Used to convert point labels + // Function - Used to convert point labels callback: function(label) { return label; } @@ -347,7 +347,7 @@ module.exports = function(Chart) { } ctx.textAlign = 'center'; - ctx.textBaseline = "middle"; + ctx.textBaseline = 'middle'; ctx.fillStyle = tickFontColor; ctx.fillText(label, me.xCenter, yHeight); } @@ -412,6 +412,6 @@ module.exports = function(Chart) { } } }); - Chart.scaleService.registerScaleType("radialLinear", LinearRadialScale, defaultConfig); + Chart.scaleService.registerScaleType('radialLinear', LinearRadialScale, defaultConfig); }; diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 23435aa13..7895dd490 100755 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -1,5 +1,5 @@ -/*global window: false */ -"use strict"; +/* global window: false */ +'use strict'; var moment = require('moment'); moment = typeof(moment) === 'function' ? moment : window.moment; @@ -39,7 +39,7 @@ module.exports = function(Chart) { }; var defaultConfig = { - position: "bottom", + position: 'bottom', time: { parser: false, // false == a pattern string from http://momentjs.com/docs/#/parsing/string-format/ or a custom callback that converts its argument to a moment @@ -451,13 +451,13 @@ module.exports = function(Chart) { } // Custom parsing (return an instance of moment) if (typeof me.options.time.format !== 'string' && me.options.time.format.call) { - console.warn("options.time.format is deprecated and replaced by options.time.parser. See http://nnnick.github.io/Chart.js/docs-v2/#scales-time-scale"); + console.warn('options.time.format is deprecated and replaced by options.time.parser. See http://nnnick.github.io/Chart.js/docs-v2/#scales-time-scale'); return me.options.time.format(label); } // Moment format parsing return moment(label, me.options.time.format); } }); - Chart.scaleService.registerScaleType("time", TimeScale, defaultConfig); + Chart.scaleService.registerScaleType('time', TimeScale, defaultConfig); };