From 3ff10ac717e069aaf004750ef58a5978abcb02f4 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sat, 27 Jan 2018 22:24:51 +0000 Subject: [PATCH 01/41] Add htmllint --- gulpfile.js | 16 +++++++++++++++- package.json | 1 + samples/advanced/progress-bar.html | 2 +- samples/charts/doughnut.html | 2 +- samples/charts/pie.html | 2 +- samples/scales/time/financial.html | 4 ++-- samples/tooltips/custom-line.html | 2 +- 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 09165c8b041..aa191a37ffe 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,7 +20,9 @@ var collapse = require('bundle-collapser/plugin'); var yargs = require('yargs'); var path = require('path'); var fs = require('fs'); +var htmllint = require('gulp-htmllint'); var package = require('./package.json'); +var htmllintOptions = require('./.htmllintrc.js'); var argv = yargs .option('force-output', {default: false}) @@ -31,6 +33,12 @@ var argv = yargs var srcDir = './src/'; var outDir = './dist/'; +var htmlFiles = [ + './samples/*.html', + './samples/*/*.html', + './samples/*/*/*.html', +]; + var header = "/*!\n" + " * Chart.js\n" + " * http://chartjs.org/\n" + @@ -50,8 +58,9 @@ gulp.task('build', buildTask); gulp.task('package', packageTask); gulp.task('watch', watchTask); gulp.task('lint', lintTask); +gulp.task('lint-html', lintHtmlTask); gulp.task('docs', docsTask); -gulp.task('test', ['lint', 'validHTML', 'unittest']); +gulp.task('test', ['lint', 'lint-html', 'validHTML', 'unittest']); gulp.task('size', ['library-size', 'module-sizes']); gulp.task('server', serverTask); gulp.task('validHTML', validHTMLTask); @@ -176,6 +185,11 @@ function lintTask() { .pipe(eslint.failAfterError()); } +function lintHtmlTask() { + return gulp.src(htmlFiles) + .pipe(htmllint(htmllintOptions)); +} + function docsTask(done) { const script = require.resolve('gitbook-cli/bin/gitbook.js'); const cmd = process.execPath; diff --git a/package.json b/package.json index c7d21043b1a..794c8f25855 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "gulp-eslint": "^4.0.0", "gulp-file": "^0.3.0", "gulp-html-validator": "^0.0.5", + "gulp-htmllint": "0.0.15", "gulp-insert": "~0.5.0", "gulp-replace": "^0.6.1", "gulp-size": "~2.1.0", diff --git a/samples/advanced/progress-bar.html b/samples/advanced/progress-bar.html index d460bc88e2a..f52edbe06b4 100644 --- a/samples/advanced/progress-bar.html +++ b/samples/advanced/progress-bar.html @@ -93,4 +93,4 @@ - \ No newline at end of file + diff --git a/samples/charts/doughnut.html b/samples/charts/doughnut.html index b288fe1293f..930537c9313 100644 --- a/samples/charts/doughnut.html +++ b/samples/charts/doughnut.html @@ -16,7 +16,7 @@
- +
diff --git a/samples/charts/pie.html b/samples/charts/pie.html index e931cee3fde..baf39716cc1 100644 --- a/samples/charts/pie.html +++ b/samples/charts/pie.html @@ -9,7 +9,7 @@
- +
diff --git a/samples/scales/time/financial.html b/samples/scales/time/financial.html index 3d91dfa56b7..05298b1c6b0 100644 --- a/samples/scales/time/financial.html +++ b/samples/scales/time/financial.html @@ -18,7 +18,7 @@
-
+


Chart Type: @@ -94,7 +94,7 @@ document.getElementById('update').addEventListener('click', function() { var type = document.getElementById('type').value; - chart.config.data.datasets[0].type = type; + chart.config.data.datasets[0].type = type; chart.update(); }); diff --git a/samples/tooltips/custom-line.html b/samples/tooltips/custom-line.html index 011762907c4..9e22ec11f40 100644 --- a/samples/tooltips/custom-line.html +++ b/samples/tooltips/custom-line.html @@ -35,7 +35,7 @@
- +
- - + Labelling Data Points + + + -
- -
- - + document.getElementById('randomizeData').addEventListener('click', function() { + barChartData.datasets.forEach(function(dataset) { + dataset.data = dataset.data.map(function() { + return randomScalingFactor(); + }) + }); + window.myBar.update(); + }); + diff --git a/samples/advanced/progress-bar.html b/samples/advanced/progress-bar.html index f52edbe06b4..7c8d981f631 100644 --- a/samples/advanced/progress-bar.html +++ b/samples/advanced/progress-bar.html @@ -2,95 +2,95 @@ Animation Callbacks - - - + + + -
- - -
-
-
- - + window.myLine.update(); + }); + diff --git a/samples/charts/area/line-stacked.html b/samples/charts/area/line-stacked.html index 26ee6b18f8f..f76762fab9b 100644 --- a/samples/charts/area/line-stacked.html +++ b/samples/charts/area/line-stacked.html @@ -36,53 +36,53 @@ borderColor: window.chartColors.red, backgroundColor: window.chartColors.red, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor() - ], + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor() + ], }, { label: "My Second dataset", borderColor: window.chartColors.blue, backgroundColor: window.chartColors.blue, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor() - ], + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor() + ], }, { label: "My Third dataset", borderColor: window.chartColors.green, backgroundColor: window.chartColors.green, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor() - ], + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor() + ], }, { label: "My Third dataset", borderColor: window.chartColors.yellow, backgroundColor: window.chartColors.yellow, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor() - ], + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor() + ], }] }, options: { diff --git a/samples/charts/bar/horizontal.html b/samples/charts/bar/horizontal.html index 0cfb78e84d0..6b081d4eb60 100644 --- a/samples/charts/bar/horizontal.html +++ b/samples/charts/bar/horizontal.html @@ -2,148 +2,148 @@ - Horizontal Bar Chart - - - + Horizontal Bar Chart + + + -
- -
- - - - - - +
+ +
+ + + + + + diff --git a/samples/charts/bar/multi-axis.html b/samples/charts/bar/multi-axis.html index 28755a701a5..d9a7bd51b8c 100644 --- a/samples/charts/bar/multi-axis.html +++ b/samples/charts/bar/multi-axis.html @@ -2,107 +2,107 @@ - Bar Chart Multi Axis - - - + Bar Chart Multi Axis + + + -
- -
- - + document.getElementById('randomizeData').addEventListener('click', function() { + barChartData.datasets.forEach(function(dataset, i) { + dataset.data = dataset.data.map(function() { + return randomScalingFactor(); + }); + }); + window.myBar.update(); + }); + diff --git a/samples/charts/bar/stacked-group.html b/samples/charts/bar/stacked-group.html index 624992cfb4a..65d00033224 100644 --- a/samples/charts/bar/stacked-group.html +++ b/samples/charts/bar/stacked-group.html @@ -2,104 +2,104 @@ - Stacked Bar Chart with Groups - - - + Stacked Bar Chart with Groups + + + -
- -
- - + document.getElementById('randomizeData').addEventListener('click', function() { + barChartData.datasets.forEach(function(dataset, i) { + dataset.data = dataset.data.map(function() { + return randomScalingFactor(); + }); + }); + window.myBar.update(); + }); + diff --git a/samples/charts/bar/stacked.html b/samples/charts/bar/stacked.html index 46d1c4051f3..d59d5a6cd56 100644 --- a/samples/charts/bar/stacked.html +++ b/samples/charts/bar/stacked.html @@ -2,101 +2,101 @@ - Stacked Bar Chart - - - + Stacked Bar Chart + + + -
- -
- - + document.getElementById('randomizeData').addEventListener('click', function() { + barChartData.datasets.forEach(function(dataset, i) { + dataset.data = dataset.data.map(function() { + return randomScalingFactor(); + }); + }); + window.myBar.update(); + }); + diff --git a/samples/charts/bar/vertical.html b/samples/charts/bar/vertical.html index 906b4624c39..16eeb122b3a 100644 --- a/samples/charts/bar/vertical.html +++ b/samples/charts/bar/vertical.html @@ -2,143 +2,143 @@ - Bar Chart - - - + Bar Chart + + + -
- -
- - - - - - +
+ +
+ + + + + + diff --git a/samples/charts/bubble.html b/samples/charts/bubble.html index 0df09477f5c..68e1d06795b 100644 --- a/samples/charts/bubble.html +++ b/samples/charts/bubble.html @@ -2,190 +2,190 @@ - Bubble Chart - - - + Bubble Chart + + + -
- -
- - - - - - + window.myChart.update(); + }); + diff --git a/samples/charts/combo-bar-line.html b/samples/charts/combo-bar-line.html index 0906029c41d..5c984ad7861 100644 --- a/samples/charts/combo-bar-line.html +++ b/samples/charts/combo-bar-line.html @@ -2,100 +2,100 @@ - Combo Bar-Line Chart - - - + Combo Bar-Line Chart + + + -
- -
- - + document.getElementById('randomizeData').addEventListener('click', function() { + chartData.datasets.forEach(function(dataset) { + dataset.data = dataset.data.map(function() { + return randomScalingFactor(); + }); + }); + window.myMixedChart.update(); + }); + diff --git a/samples/charts/doughnut.html b/samples/charts/doughnut.html index 930537c9313..86f9ed46cf8 100644 --- a/samples/charts/doughnut.html +++ b/samples/charts/doughnut.html @@ -2,143 +2,143 @@ - Doughnut Chart - - - + Doughnut Chart + + + -
- -
- - - - - - +
+ +
+ + + + + + diff --git a/samples/charts/line/basic.html b/samples/charts/line/basic.html index db01ccf743d..8ce4079b331 100644 --- a/samples/charts/line/basic.html +++ b/samples/charts/line/basic.html @@ -2,162 +2,162 @@ - Line Chart - - - + Line Chart + + + -
- -
-
-
- - - - - - +
+ +
+
+
+ + + + + + diff --git a/samples/charts/line/interpolation-modes.html b/samples/charts/line/interpolation-modes.html index 374da49c083..221b9bf7f77 100644 --- a/samples/charts/line/interpolation-modes.html +++ b/samples/charts/line/interpolation-modes.html @@ -2,102 +2,102 @@ - Line Chart - Cubic interpolation mode - - - + Line Chart - Cubic interpolation mode + + + -
- -
-
-
- - + diff --git a/samples/charts/line/line-styles.html b/samples/charts/line/line-styles.html index ed268e1fdb4..36aba5997d6 100644 --- a/samples/charts/line/line-styles.html +++ b/samples/charts/line/line-styles.html @@ -2,110 +2,110 @@ - Line Styles - - - + Line Styles + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/charts/line/multi-axis.html b/samples/charts/line/multi-axis.html index 2ede74446ae..70dbc264747 100644 --- a/samples/charts/line/multi-axis.html +++ b/samples/charts/line/multi-axis.html @@ -2,103 +2,103 @@ - Line Chart Multiple Axes - - - + Line Chart Multiple Axes + + + -
- -
- - + window.myLine.update(); + }); + diff --git a/samples/charts/line/point-sizes.html b/samples/charts/line/point-sizes.html index 823c6d3e41c..06540c733f2 100644 --- a/samples/charts/line/point-sizes.html +++ b/samples/charts/line/point-sizes.html @@ -2,129 +2,129 @@ - Different Point Sizes - - - + Different Point Sizes + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/charts/line/point-styles.html b/samples/charts/line/point-styles.html index 1985d394d23..7ca2351c16e 100644 --- a/samples/charts/line/point-styles.html +++ b/samples/charts/line/point-styles.html @@ -2,95 +2,95 @@ - Line Chart - - - + Line Chart + + + -
-
- + var ctx = canvas.getContext('2d'); + var config = createConfig(pointStyle); + new Chart(ctx, config); + }); + }; + diff --git a/samples/charts/line/skip-points.html b/samples/charts/line/skip-points.html index 00aa81fe045..b2b8d9ce269 100644 --- a/samples/charts/line/skip-points.html +++ b/samples/charts/line/skip-points.html @@ -2,94 +2,94 @@ - Line Chart - - - + Line Chart + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/charts/line/stepped.html b/samples/charts/line/stepped.html index ccce87c2dcf..8018e7d3691 100644 --- a/samples/charts/line/stepped.html +++ b/samples/charts/line/stepped.html @@ -2,9 +2,9 @@ - Stepped Line Chart - - + Stepped Line Chart + + + Polar Area Chart + + + -
- -
- - - - + var colorNames = Object.keys(window.chartColors); + document.getElementById('addData').addEventListener('click', function() { + if (config.data.datasets.length > 0) { + config.data.labels.push('data #' + config.data.labels.length); + config.data.datasets.forEach(function(dataset) { + var colorName = colorNames[config.data.labels.length % colorNames.length]; + dataset.backgroundColor.push(window.chartColors[colorName]); + dataset.data.push(randomScalingFactor()); + }); + window.myPolarArea.update(); + } + }); + document.getElementById('removeData').addEventListener('click', function() { + config.data.labels.pop(); // remove the label first + config.data.datasets.forEach(function(dataset) { + dataset.backgroundColor.pop(); + dataset.data.pop(); + }); + window.myPolarArea.update(); + }); + diff --git a/samples/charts/radar-skip-points.html b/samples/charts/radar-skip-points.html index ab29b3a0e34..56fa737e349 100644 --- a/samples/charts/radar-skip-points.html +++ b/samples/charts/radar-skip-points.html @@ -2,108 +2,108 @@ - Radar Chart - - - + Radar Chart + + + -
- -
- - + window.myRadar.update(); + }); + diff --git a/samples/charts/radar.html b/samples/charts/radar.html index fbbb9d972bc..32bba25377a 100644 --- a/samples/charts/radar.html +++ b/samples/charts/radar.html @@ -2,145 +2,145 @@ - Radar Chart - - - + Radar Chart + + + -
- -
- - - - - - +
+ +
+ + + + + + diff --git a/samples/charts/scatter/basic.html b/samples/charts/scatter/basic.html index c5e36e9d99c..f85289ee907 100644 --- a/samples/charts/scatter/basic.html +++ b/samples/charts/scatter/basic.html @@ -2,106 +2,106 @@ - Scatter Chart - - - + Scatter Chart + + + -
- -
- - + document.getElementById('randomizeData').addEventListener('click', function() { + scatterChartData.datasets.forEach(function(dataset) { + dataset.data = dataset.data.map(function() { + return { + x: randomScalingFactor(), + y: randomScalingFactor() + }; + }); + }); + window.myScatter.update(); + }); + diff --git a/samples/legend/point-style.html b/samples/legend/point-style.html index 727c7a6d85c..937114b0d8f 100644 --- a/samples/legend/point-style.html +++ b/samples/legend/point-style.html @@ -2,115 +2,115 @@ - Legend Point Style - - - + Legend Point Style + + + -
-
- -
-
- -
-
- + window.onload = function() { + [{ + id: 'chart-legend-normal', + config: createConfig('red') + }, { + id: 'chart-legend-pointstyle', + config: createPointStyleConfig('blue') + }].forEach(function(details) { + var ctx = document.getElementById(details.id).getContext('2d'); + new Chart(ctx, details.config) + }) + }; + diff --git a/samples/legend/positioning.html b/samples/legend/positioning.html index 97bc70fa047..5043f78c8f6 100644 --- a/samples/legend/positioning.html +++ b/samples/legend/positioning.html @@ -2,120 +2,120 @@ - Legend Positions - - - + Legend Positions + + + -
-
- -
-
- -
-
- -
-
- -
-
- + window.onload = function() { + [{ + id: 'chart-legend-top', + legendPosition: 'top', + color: 'red' + }, { + id: 'chart-legend-right', + legendPosition: 'right', + color: 'blue' + }, { + id: 'chart-legend-bottom', + legendPosition: 'bottom', + color: 'green' + }, { + id: 'chart-legend-left', + legendPosition: 'left', + color: 'yellow' + }].forEach(function(details) { + var ctx = document.getElementById(details.id).getContext('2d'); + var config = createConfig(details.legendPosition, details.color); + new Chart(ctx, config) + }) + }; + diff --git a/samples/scales/filtering-labels.html b/samples/scales/filtering-labels.html index 4af89025eb4..1681b6f3057 100644 --- a/samples/scales/filtering-labels.html +++ b/samples/scales/filtering-labels.html @@ -2,92 +2,92 @@ - Chart with xAxis Filtering - - - + Chart with xAxis Filtering + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/gridlines-display.html b/samples/scales/gridlines-display.html index c21469329b8..da077eeef01 100644 --- a/samples/scales/gridlines-display.html +++ b/samples/scales/gridlines-display.html @@ -2,123 +2,123 @@ - Grid Lines Display Settings - - - + Grid Lines Display Settings + + + -
- + var ctx = canvas.getContext('2d'); + var config = createConfig(details.gridLines, details.title); + new Chart(ctx, config); + }); + }; + diff --git a/samples/scales/gridlines-style.html b/samples/scales/gridlines-style.html index f945cb266d4..d30437e1dff 100644 --- a/samples/scales/gridlines-style.html +++ b/samples/scales/gridlines-style.html @@ -2,68 +2,68 @@ - Grid Lines Style Settings - - - + Grid Lines Style Settings + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/linear/min-max-suggested.html b/samples/scales/linear/min-max-suggested.html index 18059548a7f..7b2f6e89983 100644 --- a/samples/scales/linear/min-max-suggested.html +++ b/samples/scales/linear/min-max-suggested.html @@ -2,66 +2,66 @@ - Suggested Min/Max Settings - - - + Suggested Min/Max Settings + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/linear/min-max.html b/samples/scales/linear/min-max.html index 868bc7b1db5..ce03725d0a8 100644 --- a/samples/scales/linear/min-max.html +++ b/samples/scales/linear/min-max.html @@ -2,63 +2,63 @@ - Min/Max Settings - - - + Min/Max Settings + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/linear/step-size.html b/samples/scales/linear/step-size.html index ced0b6c3ca3..8e4a9601e64 100644 --- a/samples/scales/linear/step-size.html +++ b/samples/scales/linear/step-size.html @@ -2,174 +2,174 @@ - Line Chart - - - + Line Chart + + + -
- -
-
-
- - - - - - +
+ +
+
+
+ + + + + + diff --git a/samples/scales/logarithmic/line.html b/samples/scales/logarithmic/line.html index 2c961abd2e1..39bedfd674e 100644 --- a/samples/scales/logarithmic/line.html +++ b/samples/scales/logarithmic/line.html @@ -2,96 +2,96 @@ - Logarithmic Line Chart - - - + Logarithmic Line Chart + + + -
- -
- - + window.myLine.update(); + }); + diff --git a/samples/scales/logarithmic/scatter.html b/samples/scales/logarithmic/scatter.html index a4bd577c273..acd11dde2a9 100644 --- a/samples/scales/logarithmic/scatter.html +++ b/samples/scales/logarithmic/scatter.html @@ -2,29 +2,29 @@ - Scatter Chart - - - + Scatter Chart + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myScatter = Chart.Scatter(ctx, { + data: scatterChartData, + options: { + title: { + display: true, + text: 'Chart.js Scatter Chart - Logarithmic X-Axis' + }, + scales: { + xAxes: [{ + type: 'logarithmic', + position: 'bottom', + ticks: { + userCallback: function(tick) { + var remain = tick / (Math.pow(10, Math.floor(Chart.helpers.log10(tick)))); + if (remain === 1 || remain === 2 || remain === 5) { + return tick.toString() + "Hz"; + } + return ''; + }, + }, + scaleLabel: { + labelString: 'Frequency', + display: true, + } + }], + yAxes: [{ + type: 'linear', + ticks: { + userCallback: function(tick) { + return tick.toString() + "dB"; + } + }, + scaleLabel: { + labelString: 'Voltage', + display: true + } + }] + } + } + }); + }; + diff --git a/samples/scales/multiline-labels.html b/samples/scales/multiline-labels.html index b7bb041e973..1385ab85938 100644 --- a/samples/scales/multiline-labels.html +++ b/samples/scales/multiline-labels.html @@ -2,85 +2,85 @@ - Line Chart - - - + Line Chart + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/non-numeric-y.html b/samples/scales/non-numeric-y.html index 07e319b7090..3a2380aacc8 100644 --- a/samples/scales/non-numeric-y.html +++ b/samples/scales/non-numeric-y.html @@ -2,72 +2,72 @@ - Line Chart - - - + Line Chart + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/time/combo.html b/samples/scales/time/combo.html index ddcc5b326bf..e9291bcebba 100644 --- a/samples/scales/time/combo.html +++ b/samples/scales/time/combo.html @@ -7,11 +7,11 @@ @@ -92,9 +92,9 @@ }, ] }, options: { - title: { - text:"Chart.js Combo Time Scale" - }, + title: { + text:"Chart.js Combo Time Scale" + }, scales: { xAxes: [{ type: "time", diff --git a/samples/scales/time/line-point-data.html b/samples/scales/time/line-point-data.html index 3483c454535..cbb7030ad53 100644 --- a/samples/scales/time/line-point-data.html +++ b/samples/scales/time/line-point-data.html @@ -7,11 +7,11 @@ @@ -89,12 +89,12 @@ display: true, labelString: 'Date' }, - ticks: { - major: { - fontStyle: "bold", - fontColor: "#FF0000" - } - } + ticks: { + major: { + fontStyle: "bold", + fontColor: "#FF0000" + } + } }], yAxes: [{ display: true, diff --git a/samples/scales/time/line.html b/samples/scales/time/line.html index 0cca931e009..2bbcdef90e4 100644 --- a/samples/scales/time/line.html +++ b/samples/scales/time/line.html @@ -7,11 +7,11 @@ @@ -103,9 +103,9 @@ }] }, options: { - title:{ - text: "Chart.js Time Scale" - }, + title:{ + text: "Chart.js Time Scale" + }, scales: { xAxes: [{ type: "time", diff --git a/samples/scales/toggle-scale-type.html b/samples/scales/toggle-scale-type.html index b46687e823a..fe32ebeeb8d 100644 --- a/samples/scales/toggle-scale-type.html +++ b/samples/scales/toggle-scale-type.html @@ -2,98 +2,98 @@ - Toggle Scale Type - - - + Toggle Scale Type + + + -
- -
- - + window.myLine.update(); + }); + diff --git a/samples/tooltips/callbacks.html b/samples/tooltips/callbacks.html index 590edd1a236..d44b4f61df0 100644 --- a/samples/tooltips/callbacks.html +++ b/samples/tooltips/callbacks.html @@ -2,106 +2,106 @@ - Tooltip Hooks - - - + Tooltip Hooks + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById("canvas").getContext("2d"); + window.myLine = new Chart(ctx, config); + }; + From 7cfcf5a9a0b767d0fbc726623240c37d4abada37 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 18:25:00 +0000 Subject: [PATCH 07/41] Setup eslint fix --- gulpfile.js | 9 ++++++++- package.json | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 8e478782ebe..10b24868545 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -24,6 +24,8 @@ var htmllint = require('gulp-htmllint'); var package = require('./package.json'); var htmllintOptions = require('./.htmllintrc.js'); +var gulpIf = require('gulp-if'); + var argv = yargs .option('force-output', {default: false}) .option('silent-errors', {default: false}) @@ -155,7 +157,10 @@ function packageTask() { .pipe(zip('Chart.js.zip')) .pipe(gulp.dest(outDir)); } - +function isFixed(file) { + // Has ESLint fixed the file contents? + return file.eslint != null && file.eslint.fixed; +} function lintTask() { var files = [ 'samples/**/*.js', @@ -169,6 +174,7 @@ function lintTask() { // compare to what the current codebase can support, and since it's not straightforward // to fix, let's turn them as warnings and rewrite code later progressively. var options = { + fix: true, rules: { 'complexity': [1, 10], 'max-statements': [1, 30] @@ -178,6 +184,7 @@ function lintTask() { return gulp.src(files) .pipe(eslint(options)) .pipe(eslint.format()) + .pipe(gulpIf(isFixed, gulp.dest('./'))) .pipe(eslint.failAfterError()); } diff --git a/package.json b/package.json index 99db3a4fac3..8ff825c0461 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "gulp-file": "^0.3.0", "gulp-html-validator": "^0.0.5", "gulp-htmllint": "0.0.15", + "gulp-if": "^2.0.2", "gulp-insert": "~0.5.0", "gulp-replace": "^0.6.1", "gulp-size": "~2.1.0", From 1b591b14183e31a416466a9c6622971db8b503bc Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 18:36:19 +0000 Subject: [PATCH 08/41] setup --- gulpfile.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 10b24868545..efd1508be55 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -163,11 +163,11 @@ function isFixed(file) { } function lintTask() { var files = [ - 'samples/**/*.js', - 'src/**/*.js', - 'test/**/*.js', + //'samples/**/*.js', + //'src/**/*.js', + //'test/**/*.js', './samples/**/*.html', - 'dist/test.html' + //'dist/test.html' ]; // NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict @@ -184,7 +184,7 @@ function lintTask() { return gulp.src(files) .pipe(eslint(options)) .pipe(eslint.format()) - .pipe(gulpIf(isFixed, gulp.dest('./'))) + .pipe(gulpIf(isFixed, gulp.dest('./samples/'))) .pipe(eslint.failAfterError()); } From 9f130a23abbc61aa211a55150138c0ebfe81856f Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 18:36:53 +0000 Subject: [PATCH 09/41] Autofix eslint --- samples/advanced/data-labelling.html | 170 ++++++------ samples/advanced/progress-bar.html | 110 ++++---- samples/charts/area/line-boundaries.html | 2 +- samples/charts/area/line-datasets.html | 2 +- samples/charts/area/line-stacked.html | 84 +++--- samples/charts/area/radar.html | 2 +- samples/charts/bar/horizontal.html | 176 ++++++------ samples/charts/bar/multi-axis.html | 146 +++++----- samples/charts/bar/stacked-group.html | 140 +++++----- samples/charts/bar/stacked.html | 134 ++++----- samples/charts/bar/vertical.html | 170 ++++++------ samples/charts/bubble.html | 258 ++++++++--------- samples/charts/combo-bar-line.html | 132 ++++----- samples/charts/doughnut.html | 162 +++++------ samples/charts/line/basic.html | 202 +++++++------- samples/charts/line/interpolation-modes.html | 114 ++++---- samples/charts/line/line-styles.html | 156 +++++------ samples/charts/line/multi-axis.html | 134 ++++----- samples/charts/line/point-sizes.html | 194 ++++++------- samples/charts/line/point-styles.html | 104 +++---- samples/charts/line/skip-points.html | 122 ++++----- samples/charts/pie.html | 106 +++---- samples/charts/polar-area.html | 132 ++++----- samples/charts/radar-skip-points.html | 134 ++++----- samples/charts/radar.html | 166 +++++------ samples/charts/scatter/basic.html | 138 +++++----- samples/charts/scatter/multi-axis.html | 30 +- samples/legend/point-style.html | 130 ++++----- samples/legend/positioning.html | 136 ++++----- samples/scales/filtering-labels.html | 112 ++++---- samples/scales/gridlines-display.html | 162 +++++------ samples/scales/gridlines-style.html | 70 ++--- samples/scales/linear/min-max-suggested.html | 66 ++--- samples/scales/linear/min-max.html | 62 ++--- samples/scales/linear/step-size.html | 214 +++++++-------- samples/scales/logarithmic/line.html | 112 ++++---- samples/scales/logarithmic/scatter.html | 274 +++++++++---------- samples/scales/multiline-labels.html | 104 +++---- samples/scales/non-numeric-y.html | 78 +++--- samples/scales/time/combo.html | 60 ++-- samples/scales/time/financial.html | 10 +- samples/scales/time/line-point-data.html | 26 +- samples/scales/time/line.html | 22 +- samples/scales/toggle-scale-type.html | 114 ++++---- samples/scriptable/bubble.html | 2 +- samples/tooltips/border.html | 6 +- samples/tooltips/callbacks.html | 144 +++++----- samples/tooltips/custom-line.html | 42 +-- samples/tooltips/custom-pie.html | 16 +- samples/tooltips/custom-points.html | 54 ++-- samples/tooltips/interactions.html | 10 +- samples/tooltips/positioning.html | 10 +- 52 files changed, 2728 insertions(+), 2728 deletions(-) diff --git a/samples/advanced/data-labelling.html b/samples/advanced/data-labelling.html index e7ee48d31e2..fbc33cbc8eb 100644 --- a/samples/advanced/data-labelling.html +++ b/samples/advanced/data-labelling.html @@ -23,108 +23,108 @@ diff --git a/samples/advanced/progress-bar.html b/samples/advanced/progress-bar.html index 7c8d981f631..5218b66f859 100644 --- a/samples/advanced/progress-bar.html +++ b/samples/advanced/progress-bar.html @@ -22,73 +22,73 @@
diff --git a/samples/charts/area/line-boundaries.html b/samples/charts/area/line-boundaries.html index edadc781c54..c1ac1fc97eb 100644 --- a/samples/charts/area/line-boundaries.html +++ b/samples/charts/area/line-boundaries.html @@ -98,7 +98,7 @@ function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); Chart.helpers.each(Chart.instances, function(chart) { - chart.options.elements.line.tension = value? 0.4 : 0.000001; + chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); }); } diff --git a/samples/charts/area/line-datasets.html b/samples/charts/area/line-datasets.html index 7bc54e3138a..741d87dde9a 100644 --- a/samples/charts/area/line-datasets.html +++ b/samples/charts/area/line-datasets.html @@ -142,7 +142,7 @@ function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); - chart.options.elements.line.tension = value? 0.4 : 0.000001; + chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); } diff --git a/samples/charts/area/line-stacked.html b/samples/charts/area/line-stacked.html index f76762fab9b..240e1c2847d 100644 --- a/samples/charts/area/line-stacked.html +++ b/samples/charts/area/line-stacked.html @@ -26,70 +26,70 @@ diff --git a/samples/charts/bar/multi-axis.html b/samples/charts/bar/multi-axis.html index d9a7bd51b8c..d839f33ab6e 100644 --- a/samples/charts/bar/multi-axis.html +++ b/samples/charts/bar/multi-axis.html @@ -21,86 +21,86 @@ diff --git a/samples/charts/bar/stacked-group.html b/samples/charts/bar/stacked-group.html index 65d00033224..bd8f665a9ac 100644 --- a/samples/charts/bar/stacked-group.html +++ b/samples/charts/bar/stacked-group.html @@ -21,83 +21,83 @@ diff --git a/samples/charts/bar/stacked.html b/samples/charts/bar/stacked.html index d59d5a6cd56..f9c71e3893a 100644 --- a/samples/charts/bar/stacked.html +++ b/samples/charts/bar/stacked.html @@ -21,80 +21,80 @@ diff --git a/samples/charts/bar/vertical.html b/samples/charts/bar/vertical.html index 16eeb122b3a..d51be6f44fe 100644 --- a/samples/charts/bar/vertical.html +++ b/samples/charts/bar/vertical.html @@ -24,119 +24,119 @@ diff --git a/samples/charts/bubble.html b/samples/charts/bubble.html index 68e1d06795b..bbd15b11997 100644 --- a/samples/charts/bubble.html +++ b/samples/charts/bubble.html @@ -29,161 +29,161 @@ var addedCount = 0; var color = Chart.helpers.color; var bubbleChartData = { - animation: { - duration: 10000 - }, - datasets: [{ - label: "My First dataset", - backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(), - borderColor: window.chartColors.red, - borderWidth: 1, - data: [{ - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }] + animation: { + duration: 10000 + }, + datasets: [{ + label: 'My First dataset', + backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(), + borderColor: window.chartColors.red, + borderWidth: 1, + data: [{ + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, }, { - label: "My Second dataset", - backgroundColor: color(window.chartColors.orange).alpha(0.5).rgbString(), - borderColor: window.chartColors.orange, - borderWidth: 1, - data: [{ - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }, { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }] + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }] + }, { + label: 'My Second dataset', + backgroundColor: color(window.chartColors.orange).alpha(0.5).rgbString(), + borderColor: window.chartColors.orange, + borderWidth: 1, + data: [{ + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }, { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, }] + }] }; window.onload = function() { - var ctx = document.getElementById("canvas").getContext("2d"); - window.myChart = new Chart(ctx, { - type: 'bubble', - data: bubbleChartData, - options: { - responsive: true, - title:{ - display:true, - text:'Chart.js Bubble Chart' - }, - tooltips: { - mode: 'point' - } - } - }); + var ctx = document.getElementById('canvas').getContext('2d'); + window.myChart = new Chart(ctx, { + type: 'bubble', + data: bubbleChartData, + options: { + responsive: true, + title: { + display: true, + text: 'Chart.js Bubble Chart' + }, + tooltips: { + mode: 'point' + } + } + }); }; document.getElementById('randomizeData').addEventListener('click', function() { - bubbleChartData.datasets.forEach(function(dataset) { - dataset.data = dataset.data.map(function() { - return { - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }; - }); + bubbleChartData.datasets.forEach(function(dataset) { + dataset.data = dataset.data.map(function() { + return { + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }; }); - window.myChart.update(); + }); + window.myChart.update(); }); var colorNames = Object.keys(window.chartColors); document.getElementById('addDataset').addEventListener('click', function() { - ++addedCount; - var colorName = colorNames[bubbleChartData.datasets.length % colorNames.length];; - var dsColor = window.chartColors[colorName]; - var newDataset = { - label: "My added dataset " + addedCount, - backgroundColor: color(dsColor).alpha(0.5).rgbString(), - borderColor: dsColor, - borderWidth: 1, - data: [] - }; + ++addedCount; + var colorName = colorNames[bubbleChartData.datasets.length % colorNames.length]; + var dsColor = window.chartColors[colorName]; + var newDataset = { + label: 'My added dataset ' + addedCount, + backgroundColor: color(dsColor).alpha(0.5).rgbString(), + borderColor: dsColor, + borderWidth: 1, + data: [] + }; - for (var index = 0; index < DEFAULT_DATASET_SIZE; ++index) { - newDataset.data.push({ - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }); - } + for (var index = 0; index < DEFAULT_DATASET_SIZE; ++index) { + newDataset.data.push({ + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }); + } - bubbleChartData.datasets.push(newDataset); - window.myChart.update(); + bubbleChartData.datasets.push(newDataset); + window.myChart.update(); }); document.getElementById('addData').addEventListener('click', function() { - if (bubbleChartData.datasets.length > 0) { - for (var index = 0; index < bubbleChartData.datasets.length; ++index) { - bubbleChartData.datasets[index].data.push({ - x: randomScalingFactor(), - y: randomScalingFactor(), - r: Math.abs(randomScalingFactor()) / 5, - }); - } - - window.myChart.update(); + if (bubbleChartData.datasets.length > 0) { + for (var index = 0; index < bubbleChartData.datasets.length; ++index) { + bubbleChartData.datasets[index].data.push({ + x: randomScalingFactor(), + y: randomScalingFactor(), + r: Math.abs(randomScalingFactor()) / 5, + }); } + + window.myChart.update(); + } }); document.getElementById('removeDataset').addEventListener('click', function() { - bubbleChartData.datasets.splice(0, 1); - window.myChart.update(); + bubbleChartData.datasets.splice(0, 1); + window.myChart.update(); }); document.getElementById('removeData').addEventListener('click', function() { - bubbleChartData.datasets.forEach(function(dataset, datasetIndex) { - dataset.data.pop(); - }); + bubbleChartData.datasets.forEach(function(dataset, datasetIndex) { + dataset.data.pop(); + }); - window.myChart.update(); + window.myChart.update(); }); diff --git a/samples/charts/combo-bar-line.html b/samples/charts/combo-bar-line.html index 5c984ad7861..49c1aad8a7d 100644 --- a/samples/charts/combo-bar-line.html +++ b/samples/charts/combo-bar-line.html @@ -21,79 +21,79 @@ diff --git a/samples/charts/doughnut.html b/samples/charts/doughnut.html index 86f9ed46cf8..8e24dde4c73 100644 --- a/samples/charts/doughnut.html +++ b/samples/charts/doughnut.html @@ -25,118 +25,118 @@ diff --git a/samples/charts/line/basic.html b/samples/charts/line/basic.html index 8ce4079b331..49e883e945e 100644 --- a/samples/charts/line/basic.html +++ b/samples/charts/line/basic.html @@ -26,136 +26,136 @@ diff --git a/samples/charts/line/interpolation-modes.html b/samples/charts/line/interpolation-modes.html index 221b9bf7f77..064cb434bcf 100644 --- a/samples/charts/line/interpolation-modes.html +++ b/samples/charts/line/interpolation-modes.html @@ -24,77 +24,77 @@ diff --git a/samples/charts/line/line-styles.html b/samples/charts/line/line-styles.html index 36aba5997d6..ab8f76f0822 100644 --- a/samples/charts/line/line-styles.html +++ b/samples/charts/line/line-styles.html @@ -20,90 +20,90 @@
diff --git a/samples/charts/line/multi-axis.html b/samples/charts/line/multi-axis.html index 70dbc264747..8088f8a1b03 100644 --- a/samples/charts/line/multi-axis.html +++ b/samples/charts/line/multi-axis.html @@ -21,82 +21,82 @@ diff --git a/samples/charts/line/point-sizes.html b/samples/charts/line/point-sizes.html index 06540c733f2..fd01bf87c21 100644 --- a/samples/charts/line/point-sizes.html +++ b/samples/charts/line/point-sizes.html @@ -19,110 +19,110 @@ diff --git a/samples/charts/line/point-styles.html b/samples/charts/line/point-styles.html index 7ca2351c16e..2198e47f48b 100644 --- a/samples/charts/line/point-styles.html +++ b/samples/charts/line/point-styles.html @@ -31,64 +31,64 @@ diff --git a/samples/charts/line/skip-points.html b/samples/charts/line/skip-points.html index b2b8d9ce269..a473e65b4a8 100644 --- a/samples/charts/line/skip-points.html +++ b/samples/charts/line/skip-points.html @@ -20,74 +20,74 @@ diff --git a/samples/charts/pie.html b/samples/charts/pie.html index ad5d36494bf..279b71c5d49 100644 --- a/samples/charts/pie.html +++ b/samples/charts/pie.html @@ -16,80 +16,80 @@ diff --git a/samples/charts/polar-area.html b/samples/charts/polar-area.html index d31b0c8bdce..756d4b88755 100644 --- a/samples/charts/polar-area.html +++ b/samples/charts/polar-area.html @@ -23,93 +23,93 @@ diff --git a/samples/charts/radar-skip-points.html b/samples/charts/radar-skip-points.html index 56fa737e349..7b979216058 100644 --- a/samples/charts/radar-skip-points.html +++ b/samples/charts/radar-skip-points.html @@ -21,87 +21,87 @@ diff --git a/samples/charts/radar.html b/samples/charts/radar.html index 32bba25377a..916c154aa04 100644 --- a/samples/charts/radar.html +++ b/samples/charts/radar.html @@ -25,120 +25,120 @@ diff --git a/samples/charts/scatter/basic.html b/samples/charts/scatter/basic.html index f85289ee907..58ccb232cd2 100644 --- a/samples/charts/scatter/basic.html +++ b/samples/charts/scatter/basic.html @@ -22,84 +22,84 @@ diff --git a/samples/charts/scatter/multi-axis.html b/samples/charts/scatter/multi-axis.html index cbf3bf73a8a..6c20b98f0de 100644 --- a/samples/charts/scatter/multi-axis.html +++ b/samples/charts/scatter/multi-axis.html @@ -23,9 +23,9 @@ var color = Chart.helpers.color; var scatterChartData = { datasets: [{ - label: "My First dataset", - xAxisID: "x-axis-1", - yAxisID: "y-axis-1", + label: 'My First dataset', + xAxisID: 'x-axis-1', + yAxisID: 'y-axis-1', borderColor: window.chartColors.red, backgroundColor: color(window.chartColors.red).alpha(0.2).rgbString(), data: [{ @@ -51,9 +51,9 @@ y: randomScalingFactor(), }] }, { - label: "My Second dataset", - xAxisID: "x-axis-1", - yAxisID: "y-axis-2", + label: 'My Second dataset', + xAxisID: 'x-axis-1', + yAxisID: 'y-axis-2', borderColor: window.chartColors.blue, backgroundColor: color(window.chartColors.blue).alpha(0.2).rgbString(), data: [{ @@ -82,7 +82,7 @@ }; window.onload = function() { - var ctx = document.getElementById("canvas").getContext("2d"); + var ctx = document.getElementById('canvas').getContext('2d'); window.myScatter = Chart.Scatter(ctx, { data: scatterChartData, options: { @@ -95,22 +95,22 @@ }, scales: { xAxes: [{ - position: "bottom", + position: 'bottom', gridLines: { - zeroLineColor: "rgba(0,0,0,1)" + zeroLineColor: 'rgba(0,0,0,1)' } }], yAxes: [{ - type: "linear", // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance + type: 'linear', // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance display: true, - position: "left", - id: "y-axis-1", + position: 'left', + id: 'y-axis-1', }, { - type: "linear", // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance + type: 'linear', // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance display: true, - position: "right", + position: 'right', reverse: true, - id: "y-axis-2", + id: 'y-axis-2', // grid line settings gridLines: { diff --git a/samples/legend/point-style.html b/samples/legend/point-style.html index 937114b0d8f..cc4c2b7bdd8 100644 --- a/samples/legend/point-style.html +++ b/samples/legend/point-style.html @@ -37,78 +37,78 @@ diff --git a/samples/legend/positioning.html b/samples/legend/positioning.html index 5043f78c8f6..e7ec5e6abf1 100644 --- a/samples/legend/positioning.html +++ b/samples/legend/positioning.html @@ -43,77 +43,77 @@ diff --git a/samples/scales/filtering-labels.html b/samples/scales/filtering-labels.html index 1681b6f3057..c6819ecc87a 100644 --- a/samples/scales/filtering-labels.html +++ b/samples/scales/filtering-labels.html @@ -19,73 +19,73 @@ diff --git a/samples/scales/gridlines-display.html b/samples/scales/gridlines-display.html index da077eeef01..d973d2670bf 100644 --- a/samples/scales/gridlines-display.html +++ b/samples/scales/gridlines-display.html @@ -30,93 +30,93 @@
diff --git a/samples/scales/gridlines-style.html b/samples/scales/gridlines-style.html index d30437e1dff..db12d61e644 100644 --- a/samples/scales/gridlines-style.html +++ b/samples/scales/gridlines-style.html @@ -20,48 +20,48 @@ diff --git a/samples/scales/linear/min-max-suggested.html b/samples/scales/linear/min-max-suggested.html index 7b2f6e89983..98379918f25 100644 --- a/samples/scales/linear/min-max-suggested.html +++ b/samples/scales/linear/min-max-suggested.html @@ -20,46 +20,46 @@ diff --git a/samples/scales/linear/min-max.html b/samples/scales/linear/min-max.html index ce03725d0a8..47333506866 100644 --- a/samples/scales/linear/min-max.html +++ b/samples/scales/linear/min-max.html @@ -20,43 +20,43 @@ diff --git a/samples/scales/linear/step-size.html b/samples/scales/linear/step-size.html index 8e4a9601e64..f1701b542ed 100644 --- a/samples/scales/linear/step-size.html +++ b/samples/scales/linear/step-size.html @@ -26,147 +26,147 @@ diff --git a/samples/scales/logarithmic/line.html b/samples/scales/logarithmic/line.html index 39bedfd674e..c8819e89fac 100644 --- a/samples/scales/logarithmic/line.html +++ b/samples/scales/logarithmic/line.html @@ -21,75 +21,75 @@ diff --git a/samples/scales/logarithmic/scatter.html b/samples/scales/logarithmic/scatter.html index acd11dde2a9..8b46b09b99b 100644 --- a/samples/scales/logarithmic/scatter.html +++ b/samples/scales/logarithmic/scatter.html @@ -21,149 +21,149 @@ diff --git a/samples/scales/multiline-labels.html b/samples/scales/multiline-labels.html index 1385ab85938..9d381fb5a56 100644 --- a/samples/scales/multiline-labels.html +++ b/samples/scales/multiline-labels.html @@ -20,65 +20,65 @@ diff --git a/samples/scales/non-numeric-y.html b/samples/scales/non-numeric-y.html index 3a2380aacc8..3e8491b3ca1 100644 --- a/samples/scales/non-numeric-y.html +++ b/samples/scales/non-numeric-y.html @@ -19,53 +19,53 @@ diff --git a/samples/scales/time/combo.html b/samples/scales/time/combo.html index e9291bcebba..f070b7f2a0d 100644 --- a/samples/scales/time/combo.html +++ b/samples/scales/time/combo.html @@ -38,12 +38,12 @@ type: 'bar', data: { labels: [ - newDateString(0), - newDateString(1), - newDateString(2), - newDateString(3), - newDateString(4), - newDateString(5), + newDateString(0), + newDateString(1), + newDateString(2), + newDateString(3), + newDateString(4), + newDateString(5), newDateString(6) ], datasets: [{ @@ -52,12 +52,12 @@ backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(), borderColor: window.chartColors.red, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), randomScalingFactor() ], }, { @@ -66,12 +66,12 @@ backgroundColor: color(window.chartColors.blue).alpha(0.5).rgbString(), borderColor: window.chartColors.blue, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), randomScalingFactor() ], }, { @@ -81,23 +81,23 @@ borderColor: window.chartColors.green, fill: false, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), randomScalingFactor() ], - }, ] + }] }, options: { - title: { - text:"Chart.js Combo Time Scale" - }, + title: { + text: 'Chart.js Combo Time Scale' + }, scales: { xAxes: [{ - type: "time", + type: 'time', display: true, time: { format: timeFormat, @@ -109,7 +109,7 @@ }; window.onload = function() { - var ctx = document.getElementById("canvas").getContext("2d"); + var ctx = document.getElementById('canvas').getContext('2d'); window.myLine = new Chart(ctx, config); }; diff --git a/samples/scales/time/financial.html b/samples/scales/time/financial.html index 05298b1c6b0..66ab6a663a0 100644 --- a/samples/scales/time/financial.html +++ b/samples/scales/time/financial.html @@ -33,10 +33,10 @@ } function randomBar(date, lastClose) { - var open = randomNumber(lastClose * .95, lastClose * 1.05); - var close = randomNumber(open * .95, open * 1.05); + var open = randomNumber(lastClose * 0.95, lastClose * 1.05); + var close = randomNumber(open * 0.95, open * 1.05); var high = randomNumber(Math.max(open, close), Math.max(open, close) * 1.1); - var low = randomNumber(Math.min(open, close) * .9, Math.min(open, close)); + var low = randomNumber(Math.min(open, close) * 0.9, Math.min(open, close)); return { t: date.valueOf(), y: close @@ -55,7 +55,7 @@ } } - var ctx = document.getElementById("chart1").getContext("2d"); + var ctx = document.getElementById('chart1').getContext('2d'); ctx.canvas.width = 1000; ctx.canvas.height = 300; var cfg = { @@ -63,7 +63,7 @@ data: { labels: labels, datasets: [{ - label: "CHRT - Chart.js Corporation", + label: 'CHRT - Chart.js Corporation', data: data, type: 'line', pointRadius: 0, diff --git a/samples/scales/time/line-point-data.html b/samples/scales/time/line-point-data.html index cbb7030ad53..affdf268caf 100644 --- a/samples/scales/time/line-point-data.html +++ b/samples/scales/time/line-point-data.html @@ -38,7 +38,7 @@ type: 'line', data: { datasets: [{ - label: "Dataset with string point data", + label: 'Dataset with string point data', backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(), borderColor: window.chartColors.red, fill: false, @@ -56,7 +56,7 @@ y: randomScalingFactor() }], }, { - label: "Dataset with date object point data", + label: 'Dataset with date object point data', backgroundColor: color(window.chartColors.blue).alpha(0.5).rgbString(), borderColor: window.chartColors.blue, fill: false, @@ -77,24 +77,24 @@ }, options: { responsive: true, - title:{ - display:true, - text:"Chart.js Time Point Data" + title: { + display: true, + text: 'Chart.js Time Point Data' }, scales: { xAxes: [{ - type: "time", + type: 'time', display: true, scaleLabel: { display: true, labelString: 'Date' }, - ticks: { - major: { - fontStyle: "bold", - fontColor: "#FF0000" - } - } + ticks: { + major: { + fontStyle: 'bold', + fontColor: '#FF0000' + } + } }], yAxes: [{ display: true, @@ -108,7 +108,7 @@ }; window.onload = function() { - var ctx = document.getElementById("canvas").getContext("2d"); + var ctx = document.getElementById('canvas').getContext('2d'); window.myLine = new Chart(ctx, config); }; diff --git a/samples/scales/time/line.html b/samples/scales/time/line.html index 2bbcdef90e4..aaaa6117f4f 100644 --- a/samples/scales/time/line.html +++ b/samples/scales/time/line.html @@ -55,7 +55,7 @@ newDate(6) ], datasets: [{ - label: "My First dataset", + label: 'My First dataset', backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(), borderColor: window.chartColors.red, fill: false, @@ -69,7 +69,7 @@ randomScalingFactor() ], }, { - label: "My Second dataset", + label: 'My Second dataset', backgroundColor: color(window.chartColors.blue).alpha(0.5).rgbString(), borderColor: window.chartColors.blue, fill: false, @@ -83,7 +83,7 @@ randomScalingFactor() ], }, { - label: "Dataset with point data", + label: 'Dataset with point data', backgroundColor: color(window.chartColors.green).alpha(0.5).rgbString(), borderColor: window.chartColors.green, fill: false, @@ -103,12 +103,12 @@ }] }, options: { - title:{ - text: "Chart.js Time Scale" - }, + title: { + text: 'Chart.js Time Scale' + }, scales: { xAxes: [{ - type: "time", + type: 'time', time: { format: timeFormat, // round: 'day' @@ -118,7 +118,7 @@ display: true, labelString: 'Date' } - }, ], + }], yAxes: [{ scaleLabel: { display: true, @@ -130,7 +130,7 @@ }; window.onload = function() { - var ctx = document.getElementById("canvas").getContext("2d"); + var ctx = document.getElementById('canvas').getContext('2d'); window.myLine = new Chart(ctx, config); }; @@ -152,7 +152,7 @@ var colorNames = Object.keys(window.chartColors); document.getElementById('addDataset').addEventListener('click', function() { var colorName = colorNames[config.data.datasets.length % colorNames.length]; - var newColor = window.chartColors[colorName] + var newColor = window.chartColors[colorName]; var newDataset = { label: 'Dataset ' + config.data.datasets.length, borderColor: newColor, @@ -173,7 +173,7 @@ config.data.labels.push(newDate(config.data.labels.length)); for (var index = 0; index < config.data.datasets.length; ++index) { - if (typeof config.data.datasets[index].data[0] === "object") { + if (typeof config.data.datasets[index].data[0] === 'object') { config.data.datasets[index].data.push({ x: newDate(config.data.datasets[index].data.length), y: randomScalingFactor(), diff --git a/samples/scales/toggle-scale-type.html b/samples/scales/toggle-scale-type.html index fe32ebeeb8d..d7e602ad0e0 100644 --- a/samples/scales/toggle-scale-type.html +++ b/samples/scales/toggle-scale-type.html @@ -21,77 +21,77 @@ diff --git a/samples/scriptable/bubble.html b/samples/scriptable/bubble.html index feaf1ecb84c..b5a8f434760 100644 --- a/samples/scriptable/bubble.html +++ b/samples/scriptable/bubble.html @@ -108,7 +108,7 @@ function randomize() { chart.data.datasets.forEach(function(dataset) { - dataset.data = generateData() + dataset.data = generateData(); }); chart.update(); } diff --git a/samples/tooltips/border.html b/samples/tooltips/border.html index 25c649e548e..ac125baa916 100644 --- a/samples/tooltips/border.html +++ b/samples/tooltips/border.html @@ -34,9 +34,9 @@ return { type: 'line', data: { - labels: ["January", "February", "March", "April", "May", "June", "July"], + labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ - label: "Dataset", + label: 'Dataset', borderColor: window.chartColors.red, backgroundColor: window.chartColors.red, data: [10, 30, 46, 2, 8, 50, 0], @@ -45,7 +45,7 @@ }, options: { responsive: true, - title:{ + title: { display: true, text: 'Sample tooltip with border' }, diff --git a/samples/tooltips/callbacks.html b/samples/tooltips/callbacks.html index d44b4f61df0..31097ca8d6d 100644 --- a/samples/tooltips/callbacks.html +++ b/samples/tooltips/callbacks.html @@ -20,86 +20,86 @@ diff --git a/samples/tooltips/custom-line.html b/samples/tooltips/custom-line.html index 9e22ec11f40..96cfac6fd3c 100644 --- a/samples/tooltips/custom-line.html +++ b/samples/tooltips/custom-line.html @@ -47,7 +47,7 @@ if (!tooltipEl) { tooltipEl = document.createElement('div'); tooltipEl.id = 'chartjs-tooltip'; - tooltipEl.innerHTML = "
" + tooltipEl.innerHTML = '
'; this._chart.canvas.parentNode.appendChild(tooltipEl); } @@ -85,7 +85,7 @@ var colors = tooltip.labelColors[i]; var style = 'background:' + colors.backgroundColor; style += '; border-color:' + colors.borderColor; - style += '; border-width: 2px'; + style += '; border-width: 2px'; var span = ''; innerHtml += '' + span + body + ''; }); @@ -109,47 +109,47 @@ }; var lineChartData = { - labels: ["January", "February", "March", "April", "May", "June", "July"], + labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ - label: "My First dataset", + label: 'My First dataset', borderColor: window.chartColors.red, pointBackgroundColor: window.chartColors.red, fill: false, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), randomScalingFactor() ] }, { - label: "My Second dataset", + label: 'My Second dataset', borderColor: window.chartColors.blue, pointBackgroundColor: window.chartColors.blue, fill: false, data: [ - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), - randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), + randomScalingFactor(), randomScalingFactor() ] }] }; window.onload = function() { - var chartEl = document.getElementById("chart"); + var chartEl = document.getElementById('chart'); window.myLine = new Chart(chartEl, { type: 'line', data: lineChartData, options: { - title:{ - display:true, - text:'Chart.js Line Chart - Custom Tooltips' + title: { + display: true, + text: 'Chart.js Line Chart - Custom Tooltips' }, tooltips: { enabled: false, diff --git a/samples/tooltips/custom-pie.html b/samples/tooltips/custom-pie.html index 7bfbc56f1e9..5e1361aac45 100644 --- a/samples/tooltips/custom-pie.html +++ b/samples/tooltips/custom-pie.html @@ -81,7 +81,7 @@ var colors = tooltip.labelColors[i]; var style = 'background:' + colors.backgroundColor; style += '; border-color:' + colors.borderColor; - style += '; border-width: 2px'; + style += '; border-width: 2px'; var span = ''; innerHtml += '' + span + body + ''; }); @@ -118,11 +118,11 @@ ], }], labels: [ - "Red", - "Orange", - "Yellow", - "Green", - "Blue" + 'Red', + 'Orange', + 'Yellow', + 'Green', + 'Blue' ] }, options: { @@ -137,8 +137,8 @@ }; window.onload = function() { - var ctx = document.getElementById("chart-area").getContext("2d"); - window.myPie = new Chart(ctx, config); + var ctx = document.getElementById('chart-area').getContext('2d'); + window.myPie = new Chart(ctx, config); }; diff --git a/samples/tooltips/custom-points.html b/samples/tooltips/custom-points.html index 1bb64da4fa5..581a82d9527 100644 --- a/samples/tooltips/custom-points.html +++ b/samples/tooltips/custom-points.html @@ -41,13 +41,13 @@
diff --git a/samples/tooltips/positioning.html b/samples/tooltips/positioning.html index 696584b0677..f98cd638ced 100644 --- a/samples/tooltips/positioning.html +++ b/samples/tooltips/positioning.html @@ -34,15 +34,15 @@ return { type: 'line', data: { - labels: ["January", "February", "March", "April", "May", "June", "July"], + labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ - label: "My First dataset", + label: 'My First dataset', borderColor: window.chartColors.red, backgroundColor: window.chartColors.red, data: [10, 30, 46, 2, 8, 50, 0], fill: false, }, { - label: "My Second dataset", + label: 'My Second dataset', borderColor: window.chartColors.blue, backgroundColor: window.chartColors.blue, data: [7, 49, 46, 13, 25, 30, 22], @@ -51,7 +51,7 @@ }, options: { responsive: true, - title:{ + title: { display: true, text: 'Tooltip Position: ' + position }, @@ -78,7 +78,7 @@ var ctx = canvas.getContext('2d'); var config = createConfig(position); new Chart(ctx, config); - }) + }); }; From c640e695f6f229c2cae66e52bdf25e9b1f881ad7 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 18:40:23 +0000 Subject: [PATCH 10/41] Rollback before autofix --- gulpfile.js | 18 +++++------------- package.json | 1 - 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index efd1508be55..ff539da2fa7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -24,8 +24,6 @@ var htmllint = require('gulp-htmllint'); var package = require('./package.json'); var htmllintOptions = require('./.htmllintrc.js'); -var gulpIf = require('gulp-if'); - var argv = yargs .option('force-output', {default: false}) .option('silent-errors', {default: false}) @@ -157,24 +155,19 @@ function packageTask() { .pipe(zip('Chart.js.zip')) .pipe(gulp.dest(outDir)); } -function isFixed(file) { - // Has ESLint fixed the file contents? - return file.eslint != null && file.eslint.fixed; -} + function lintTask() { var files = [ - //'samples/**/*.js', - //'src/**/*.js', - //'test/**/*.js', - './samples/**/*.html', - //'dist/test.html' + 'samples/**/*.js', + 'src/**/*.js', + 'test/**/*.js', + './samples/**/*.html' ]; // NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict // compare to what the current codebase can support, and since it's not straightforward // to fix, let's turn them as warnings and rewrite code later progressively. var options = { - fix: true, rules: { 'complexity': [1, 10], 'max-statements': [1, 30] @@ -184,7 +177,6 @@ function lintTask() { return gulp.src(files) .pipe(eslint(options)) .pipe(eslint.format()) - .pipe(gulpIf(isFixed, gulp.dest('./samples/'))) .pipe(eslint.failAfterError()); } diff --git a/package.json b/package.json index 8ff825c0461..99db3a4fac3 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "gulp-file": "^0.3.0", "gulp-html-validator": "^0.0.5", "gulp-htmllint": "0.0.15", - "gulp-if": "^2.0.2", "gulp-insert": "~0.5.0", "gulp-replace": "^0.6.1", "gulp-size": "~2.1.0", From 098c133355b7ec9f1d6f28aabac707757a11aa56 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 20:33:42 +0000 Subject: [PATCH 11/41] Remove most errors --- gulpfile.js | 17 +++++++++---- samples/advanced/data-labelling.html | 2 +- samples/advanced/progress-bar.html | 3 +-- samples/charts/area/line-boundaries.html | 14 ++++++++--- samples/charts/area/line-datasets.html | 24 ++++++++++++++----- samples/charts/area/line-stacked.html | 2 +- samples/charts/area/radar.html | 25 +++++++++++++++----- samples/charts/bar/horizontal.html | 2 +- samples/charts/bar/multi-axis.html | 2 +- samples/charts/bar/stacked-group.html | 2 +- samples/charts/bar/stacked.html | 2 +- samples/charts/bar/vertical.html | 2 +- samples/charts/bubble.html | 2 +- samples/charts/line/basic.html | 2 +- samples/charts/line/interpolation-modes.html | 6 ++--- samples/charts/line/point-sizes.html | 1 - samples/charts/line/point-styles.html | 2 +- samples/charts/line/stepped.html | 4 ++-- samples/charts/radar.html | 2 +- samples/index.html | 6 ++--- samples/scales/filtering-labels.html | 2 -- samples/scales/linear/step-size.html | 2 +- samples/scales/non-numeric-y.html | 1 - samples/scales/time/financial.html | 2 -- samples/scales/time/line-point-data.html | 6 ++--- samples/scales/time/line.html | 12 ++++------ samples/scriptable/bubble.html | 21 ++++++++++++---- samples/tooltips/border.html | 1 - samples/tooltips/custom-points.html | 2 +- 29 files changed, 106 insertions(+), 65 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index ff539da2fa7..7d36d8e4b44 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -161,7 +161,8 @@ function lintTask() { 'samples/**/*.js', 'src/**/*.js', 'test/**/*.js', - './samples/**/*.html' + './samples/**/*.html', + //'./dist/test.html' ]; // NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict @@ -170,8 +171,16 @@ function lintTask() { var options = { rules: { 'complexity': [1, 10], - 'max-statements': [1, 30] - } + 'max-statements': [1, 30], + 'no-new': 0, // TODO + 'camelcase': 0, //TODO + }, + globals: [ + '$', + 'Chart', + 'moment', + 'randomScalingFactor', + ] }; return gulp.src(files) @@ -181,7 +190,7 @@ function lintTask() { } function lintHtmlTask() { - return gulp.src(['./samples/**/*.html', + return gulp.src(['./samples/**/*.html', 'dist/test.html']) .pipe(htmllint(htmllintOptions)); } diff --git a/samples/advanced/data-labelling.html b/samples/advanced/data-labelling.html index fbc33cbc8eb..7e88ec31034 100644 --- a/samples/advanced/data-labelling.html +++ b/samples/advanced/data-labelling.html @@ -71,7 +71,7 @@ // Define a plugin to provide data labels Chart.plugins.register({ - afterDatasetsDraw: function(chart, easing) { + afterDatasetsDraw: function(chart/* , easing */) { // TODO : remove easing ? // To only draw at the end of animation, check for easing === 1 var ctx = chart.ctx; diff --git a/samples/advanced/progress-bar.html b/samples/advanced/progress-bar.html index 5218b66f859..30e5f1cecae 100644 --- a/samples/advanced/progress-bar.html +++ b/samples/advanced/progress-bar.html @@ -22,7 +22,6 @@
diff --git a/samples/charts/area/line-datasets.html b/samples/charts/area/line-datasets.html index 741d87dde9a..d867871c348 100644 --- a/samples/charts/area/line-datasets.html +++ b/samples/charts/area/line-datasets.html @@ -16,16 +16,16 @@
- - - + + +
diff --git a/samples/charts/area/line-stacked.html b/samples/charts/area/line-stacked.html index 240e1c2847d..57574c3906d 100644 --- a/samples/charts/area/line-stacked.html +++ b/samples/charts/area/line-stacked.html @@ -171,7 +171,7 @@ document.getElementById('removeData').addEventListener('click', function() { config.data.labels.splice(-1, 1); // remove the label first - config.data.datasets.forEach(function(dataset, datasetIndex) { + config.data.datasets.forEach(function(dataset) { dataset.data.pop(); }); diff --git a/samples/charts/area/radar.html b/samples/charts/area/radar.html index 3e201d39a59..e41afa9a242 100644 --- a/samples/charts/area/radar.html +++ b/samples/charts/area/radar.html @@ -16,16 +16,16 @@
- - - + + +
diff --git a/samples/charts/bar/horizontal.html b/samples/charts/bar/horizontal.html index d9901baffc0..59a8d19d559 100644 --- a/samples/charts/bar/horizontal.html +++ b/samples/charts/bar/horizontal.html @@ -137,7 +137,7 @@ document.getElementById('removeData').addEventListener('click', function() { horizontalBarChartData.labels.splice(-1, 1); // remove the label first - horizontalBarChartData.datasets.forEach(function(dataset, datasetIndex) { + horizontalBarChartData.datasets.forEach(function(dataset) { dataset.data.pop(); }); diff --git a/samples/charts/bar/multi-axis.html b/samples/charts/bar/multi-axis.html index d839f33ab6e..899bad5fb74 100644 --- a/samples/charts/bar/multi-axis.html +++ b/samples/charts/bar/multi-axis.html @@ -95,7 +95,7 @@ }; document.getElementById('randomizeData').addEventListener('click', function() { - barChartData.datasets.forEach(function(dataset, i) { + barChartData.datasets.forEach(function(dataset) { dataset.data = dataset.data.map(function() { return randomScalingFactor(); }); diff --git a/samples/charts/bar/stacked-group.html b/samples/charts/bar/stacked-group.html index bd8f665a9ac..3fae6616eae 100644 --- a/samples/charts/bar/stacked-group.html +++ b/samples/charts/bar/stacked-group.html @@ -92,7 +92,7 @@ }; document.getElementById('randomizeData').addEventListener('click', function() { - barChartData.datasets.forEach(function(dataset, i) { + barChartData.datasets.forEach(function(dataset) { dataset.data = dataset.data.map(function() { return randomScalingFactor(); }); diff --git a/samples/charts/bar/stacked.html b/samples/charts/bar/stacked.html index f9c71e3893a..f21d7d44174 100644 --- a/samples/charts/bar/stacked.html +++ b/samples/charts/bar/stacked.html @@ -89,7 +89,7 @@ }; document.getElementById('randomizeData').addEventListener('click', function() { - barChartData.datasets.forEach(function(dataset, i) { + barChartData.datasets.forEach(function(dataset) { dataset.data = dataset.data.map(function() { return randomScalingFactor(); }); diff --git a/samples/charts/bar/vertical.html b/samples/charts/bar/vertical.html index d51be6f44fe..c3311537e44 100644 --- a/samples/charts/bar/vertical.html +++ b/samples/charts/bar/vertical.html @@ -132,7 +132,7 @@ document.getElementById('removeData').addEventListener('click', function() { barChartData.labels.splice(-1, 1); // remove the label first - barChartData.datasets.forEach(function(dataset, datasetIndex) { + barChartData.datasets.forEach(function(dataset) { dataset.data.pop(); }); diff --git a/samples/charts/bubble.html b/samples/charts/bubble.html index bbd15b11997..25cf8050d97 100644 --- a/samples/charts/bubble.html +++ b/samples/charts/bubble.html @@ -179,7 +179,7 @@ }); document.getElementById('removeData').addEventListener('click', function() { - bubbleChartData.datasets.forEach(function(dataset, datasetIndex) { + bubbleChartData.datasets.forEach(function(dataset) { dataset.data.pop(); }); diff --git a/samples/charts/line/basic.html b/samples/charts/line/basic.html index 49e883e945e..4f026607daf 100644 --- a/samples/charts/line/basic.html +++ b/samples/charts/line/basic.html @@ -151,7 +151,7 @@ document.getElementById('removeData').addEventListener('click', function() { config.data.labels.splice(-1, 1); // remove the label first - config.data.datasets.forEach(function(dataset, datasetIndex) { + config.data.datasets.forEach(function(dataset) { dataset.data.pop(); }); diff --git a/samples/charts/line/interpolation-modes.html b/samples/charts/line/interpolation-modes.html index 064cb434bcf..09d7e83c81a 100644 --- a/samples/charts/line/interpolation-modes.html +++ b/samples/charts/line/interpolation-modes.html @@ -91,9 +91,9 @@ }; document.getElementById('randomizeData').addEventListener('click', function() { - for (var i = 0, len = datapoints.length; i < len; ++i) { - datapoints[i] = Math.random() < 0.05 ? NaN : randomScalingFactor(); - } + for (var i = 0, len = datapoints.length; i < len; ++i) { + datapoints[i] = Math.random() < 0.05 ? NaN : randomScalingFactor(); + } window.myLine.update(); }); diff --git a/samples/charts/line/point-sizes.html b/samples/charts/line/point-sizes.html index fd01bf87c21..eca0a08cdd2 100644 --- a/samples/charts/line/point-sizes.html +++ b/samples/charts/line/point-sizes.html @@ -19,7 +19,6 @@ diff --git a/samples/charts/line/stepped.html b/samples/charts/line/stepped.html index 8018e7d3691..771407648d2 100644 --- a/samples/charts/line/stepped.html +++ b/samples/charts/line/stepped.html @@ -36,7 +36,7 @@ data: { labels: ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6'], datasets: [{ - label: 'steppedLine: ' + ((typeof(details.steppedLine) === 'boolean') ? details.steppedLine : `'${details.steppedLine}'`), + label: 'steppedLine: ' + ((typeof (details.steppedLine) === 'boolean') ? details.steppedLine : details.steppedLine), // TODO : check this steppedLine: details.steppedLine, data: data, borderColor: details.color, @@ -94,7 +94,7 @@ var ctx = canvas.getContext('2d'); var config = createConfig(details, data); - new Chart(ctx, config); + Chart(ctx, config); }); }; diff --git a/samples/charts/radar.html b/samples/charts/radar.html index 916c154aa04..b39389cf772 100644 --- a/samples/charts/radar.html +++ b/samples/charts/radar.html @@ -96,7 +96,7 @@ var colorNames = Object.keys(window.chartColors); document.getElementById('addDataset').addEventListener('click', function() { var colorName = colorNames[config.data.datasets.length % colorNames.length]; - var newColor = window.chartColors[colorName]; + var newColor = window.chartColors[colorName]; var newDataset = { label: 'Dataset ' + config.data.datasets.length, diff --git a/samples/index.html b/samples/index.html index d855662f093..7108b279612 100644 --- a/samples/index.html +++ b/samples/index.html @@ -43,12 +43,12 @@ } var categories = document.getElementById('categories'); - Samples.items.forEach(function(item) { + window.Samples.items.forEach(function(item) { var category = createCategory(item); var children = category.getElementsByClassName('items')[0]; - (item.items || []).forEach(function(item) { - children.appendChild(createEntry(item)); + (item.items || []).forEach(function(item2) { + children.appendChild(createEntry(item2)); }); categories.appendChild(category); diff --git a/samples/scales/filtering-labels.html b/samples/scales/filtering-labels.html index c6819ecc87a..cb820e37987 100644 --- a/samples/scales/filtering-labels.html +++ b/samples/scales/filtering-labels.html @@ -19,8 +19,6 @@ @@ -37,10 +37,6 @@ return moment().add(days, 'd').format(timeFormat); } - function newTimestamp(days) { - return moment().add(days, 'd').unix(); - } - var color = Chart.helpers.color; var config = { type: 'line', @@ -195,7 +191,7 @@ document.getElementById('removeData').addEventListener('click', function() { config.data.labels.splice(-1, 1); // remove the label first - config.data.datasets.forEach(function(dataset, datasetIndex) { + config.data.datasets.forEach(function(dataset) { dataset.data.pop(); }); diff --git a/samples/scriptable/bubble.html b/samples/scriptable/bubble.html index b5a8f434760..5c23270c0c3 100644 --- a/samples/scriptable/bubble.html +++ b/samples/scriptable/bubble.html @@ -13,9 +13,9 @@
- - - + + +
@@ -24,8 +24,7 @@ var MIN_XY = -150; var MAX_XY = 100; - var presets = window.chartColors; - var utils = Samples.utils; + var utils = window.Samples.utils; utils.srand(110); @@ -124,6 +123,18 @@ chart.data.datasets.shift(); chart.update(); } + + document.getElementById('randomize').onclick = function() { + randomize(this); + }; + + document.getElementById('addDataset').onclick = function() { + addDataset(this); + }; + + document.getElementById('removeDataset').onclick = function() { + removeDataset(this); + }; diff --git a/samples/tooltips/border.html b/samples/tooltips/border.html index ac125baa916..0742be0c5f5 100644 --- a/samples/tooltips/border.html +++ b/samples/tooltips/border.html @@ -78,7 +78,6 @@ var ctx = canvas.getContext('2d'); var config = createConfig(); new Chart(ctx, config); - console.log(config); }; diff --git a/samples/tooltips/custom-points.html b/samples/tooltips/custom-points.html index 581a82d9527..f779f62f9c7 100644 --- a/samples/tooltips/custom-points.html +++ b/samples/tooltips/custom-points.html @@ -105,7 +105,7 @@ window.onload = function() { var chartEl = document.getElementById('chart1'); - var chart = new Chart(chartEl, { + new Chart(chartEl, { type: 'line', data: lineChartData, options: { From 71792f1fa66c70cc082f254dc7e7afd388a26b6b Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 20:36:02 +0000 Subject: [PATCH 12/41] Correct introduced errors --- samples/charts/line/point-styles.html | 2 +- samples/charts/line/stepped.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/charts/line/point-styles.html b/samples/charts/line/point-styles.html index 0fc01731737..2198e47f48b 100644 --- a/samples/charts/line/point-styles.html +++ b/samples/charts/line/point-styles.html @@ -87,7 +87,7 @@ var ctx = canvas.getContext('2d'); var config = createConfig(pointStyle); - Chart(ctx, config); + new Chart(ctx, config); }); }; diff --git a/samples/charts/line/stepped.html b/samples/charts/line/stepped.html index 771407648d2..a86c5b053bd 100644 --- a/samples/charts/line/stepped.html +++ b/samples/charts/line/stepped.html @@ -94,7 +94,7 @@ var ctx = canvas.getContext('2d'); var config = createConfig(details, data); - Chart(ctx, config); + new Chart(ctx, config); }); }; From 70822cfe05b5cf64d37580e56cce5e6c41366dfb Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 20:59:28 +0000 Subject: [PATCH 13/41] Check samples --- gulpfile.js | 3 +-- samples/scales/time/line-point-data.html | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 7d36d8e4b44..78331f3fce0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -190,8 +190,7 @@ function lintTask() { } function lintHtmlTask() { - return gulp.src(['./samples/**/*.html', - 'dist/test.html']) + return gulp.src('./samples/**/*.html') .pipe(htmllint(htmllintOptions)); } diff --git a/samples/scales/time/line-point-data.html b/samples/scales/time/line-point-data.html index 6433f926623..d78c8a02f67 100644 --- a/samples/scales/time/line-point-data.html +++ b/samples/scales/time/line-point-data.html @@ -122,10 +122,13 @@ window.myLine.update(); }); - document.getElementById('addData').addEventListener('click', function() { + document.getElementById('addData').addEventListener('click', function() { // TODO : fix issue with addData if (config.data.datasets.length > 0) { - var numTicks = window.myLine.scales['x-axis-0'].ticksAsTimestamps.length; - var lastTime = numTicks ? moment(window.myLine.scales['x-axis-0'].ticksAsTimestamps[numTicks - 1]) : moment(); + // var numTicks = window.myLine.scales['x-axis-0'].ticksAsTimestamps.length; // TODO : check + var numTicks = window.myLine.scales['x-axis-0'].ticks.length; + //var lastTime = numTicks ? moment(window.myLine.scales['x-axis-0'].ticksAsTimestamps[numTicks - 1]) : moment(); + var lastTime = numTicks ? moment(window.myLine.scales['x-axis-0'].ticks[numTicks - 1]) : moment(); + var newTime = lastTime .clone() .add(1, 'day') From f8f119a0f49b8447e182a4d9f56feb7a42280947 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 21:01:52 +0000 Subject: [PATCH 14/41] Fix lint --- samples/scales/time/line-point-data.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/scales/time/line-point-data.html b/samples/scales/time/line-point-data.html index d78c8a02f67..0c782ef60e4 100644 --- a/samples/scales/time/line-point-data.html +++ b/samples/scales/time/line-point-data.html @@ -126,9 +126,9 @@ if (config.data.datasets.length > 0) { // var numTicks = window.myLine.scales['x-axis-0'].ticksAsTimestamps.length; // TODO : check var numTicks = window.myLine.scales['x-axis-0'].ticks.length; - //var lastTime = numTicks ? moment(window.myLine.scales['x-axis-0'].ticksAsTimestamps[numTicks - 1]) : moment(); + // var lastTime = numTicks ? moment(window.myLine.scales['x-axis-0'].ticksAsTimestamps[numTicks - 1]) : moment(); var lastTime = numTicks ? moment(window.myLine.scales['x-axis-0'].ticks[numTicks - 1]) : moment(); - + var newTime = lastTime .clone() .add(1, 'day') From 8183537deef36168fc3ddfd4d6a2e965ea28fbef Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Sun, 28 Jan 2018 21:12:23 +0000 Subject: [PATCH 15/41] Add TODO comments --- gulpfile.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 78331f3fce0..3c162432b6c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -161,8 +161,7 @@ function lintTask() { 'samples/**/*.js', 'src/**/*.js', 'test/**/*.js', - './samples/**/*.html', - //'./dist/test.html' + './samples/**/*.html' ]; // NOTE(SB) codeclimate has 'complexity' and 'max-statements' eslint rules way too strict @@ -172,10 +171,15 @@ function lintTask() { rules: { 'complexity': [1, 10], 'max-statements': [1, 30], - 'no-new': 0, // TODO - 'camelcase': 0, //TODO + 'no-new': 0, // TODO : is this allowed ? + //TODO : see + // /Chart.js/samples/charts/area/line-datasets.html + // 125:5 error Identifier 'samples_filler_analyser' is not in camel case camelcase + // /Chart.js/samples/charts/area/radar.html + // 103:5 error Identifier 'samples_filler_analyser' is not in camel case camelcase + 'camelcase': 0, }, - globals: [ + globals: [ // TODO : do we need to use window.randomScalingFactor everytime ? '$', 'Chart', 'moment', From 01711946514b7b6863fe7acfbaaa15cbf8585a9b Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Tue, 30 Jan 2018 10:26:23 +0000 Subject: [PATCH 16/41] revert window.Samples --- samples/charts/area/line-boundaries.html | 2 +- samples/charts/area/line-datasets.html | 2 +- samples/charts/area/radar.html | 2 +- samples/index.html | 2 +- samples/scriptable/bubble.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/charts/area/line-boundaries.html b/samples/charts/area/line-boundaries.html index 8029463c26d..3223802b50e 100644 --- a/samples/charts/area/line-boundaries.html +++ b/samples/charts/area/line-boundaries.html @@ -25,7 +25,7 @@ diff --git a/samples/charts/area/line-datasets.html b/samples/charts/area/line-datasets.html index 209a8a25bb8..d232f0b90e7 100644 --- a/samples/charts/area/line-datasets.html +++ b/samples/charts/area/line-datasets.html @@ -16,9 +16,9 @@
- - - + + +
@@ -152,18 +152,6 @@ }); chart.update(); } - - document.getElementById('togglePropagate').onclick = function() { - togglePropagate(this); - }; - - document.getElementById('toggleSmooth').onclick = function() { - toggleSmooth(this); - }; - - document.getElementById('randomize').onclick = function() { - randomize(this); - }; diff --git a/samples/charts/area/radar.html b/samples/charts/area/radar.html index 88aed7411a5..6095de09856 100644 --- a/samples/charts/area/radar.html +++ b/samples/charts/area/radar.html @@ -16,9 +16,9 @@
- - - + + +
@@ -131,19 +131,6 @@ }); chart.update(); } - - document.getElementById('togglePropagate').onclick = function() { - togglePropagate(this); - }; - - document.getElementById('toggleSmooth').onclick = function() { - toggleSmooth(this); - }; - - document.getElementById('randomize').onclick = function() { - randomize(this); - }; - diff --git a/samples/scriptable/bubble.html b/samples/scriptable/bubble.html index 82df4c8fc6c..421e7a9ecf2 100644 --- a/samples/scriptable/bubble.html +++ b/samples/scriptable/bubble.html @@ -13,9 +13,9 @@
- - - + + +
@@ -123,18 +123,6 @@ chart.data.datasets.shift(); chart.update(); } - - document.getElementById('randomize').onclick = function() { - randomize(this); - }; - - document.getElementById('addDataset').onclick = function() { - addDataset(this); - }; - - document.getElementById('removeDataset').onclick = function() { - removeDataset(this); - }; From 3746bad7cd6144fd2c1741bd25be9c4ca1b4dcd2 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Thu, 1 Feb 2018 16:02:52 +0000 Subject: [PATCH 35/41] Disable no-unused-vars for inline events --- samples/charts/area/line-boundaries.html | 3 ++- samples/charts/area/line-datasets.html | 6 ++++++ samples/charts/area/radar.html | 6 ++++++ samples/scriptable/bubble.html | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/samples/charts/area/line-boundaries.html b/samples/charts/area/line-boundaries.html index c1ac1fc97eb..7ac6883bb12 100644 --- a/samples/charts/area/line-boundaries.html +++ b/samples/charts/area/line-boundaries.html @@ -94,7 +94,7 @@ }); }); - + // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); Chart.helpers.each(Chart.instances, function(chart) { @@ -103,6 +103,7 @@ }); } + // eslint-disable-next-line no-unused-vars function randomize() { var seed = utils.rand(); Chart.helpers.each(Chart.instances, function(chart) { diff --git a/samples/charts/area/line-datasets.html b/samples/charts/area/line-datasets.html index d232f0b90e7..6a69345fa30 100644 --- a/samples/charts/area/line-datasets.html +++ b/samples/charts/area/line-datasets.html @@ -134,18 +134,24 @@ options: options }); + + // eslint-disable-next-line no-unused-vars function togglePropagate(btn) { var value = btn.classList.toggle('btn-on'); chart.options.plugins.filler.propagate = value; chart.update(); } + + // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); } + + // eslint-disable-next-line no-unused-vars function randomize() { chart.data.datasets.forEach(function(dataset) { dataset.data = generateData(); diff --git a/samples/charts/area/radar.html b/samples/charts/area/radar.html index 6095de09856..33471436e95 100644 --- a/samples/charts/area/radar.html +++ b/samples/charts/area/radar.html @@ -112,18 +112,24 @@ options: options }); + + // eslint-disable-next-line no-unused-vars function togglePropagate(btn) { var value = btn.classList.toggle('btn-on'); chart.options.plugins.filler.propagate = value; chart.update(); } + + // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); } + + // eslint-disable-next-line no-unused-vars function randomize() { inputs.from = []; chart.data.datasets.forEach(function(dataset) { diff --git a/samples/scriptable/bubble.html b/samples/scriptable/bubble.html index 421e7a9ecf2..a8ce1f4743c 100644 --- a/samples/scriptable/bubble.html +++ b/samples/scriptable/bubble.html @@ -105,6 +105,7 @@ options: options }); + // eslint-disable-next-line no-unused-vars function randomize() { chart.data.datasets.forEach(function(dataset) { dataset.data = generateData(); @@ -112,6 +113,7 @@ chart.update(); } + // eslint-disable-next-line no-unused-vars function addDataset() { chart.data.datasets.push({ data: generateData() @@ -119,6 +121,7 @@ chart.update(); } + // eslint-disable-next-line no-unused-vars function removeDataset() { chart.data.datasets.shift(); chart.update(); From 261085f19457ad9887d5dd17d535e56d8dca2979 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Thu, 1 Feb 2018 16:04:57 +0000 Subject: [PATCH 36/41] Revert "Disable no-unused-vars for inline events" This reverts commit 3746bad7cd6144fd2c1741bd25be9c4ca1b4dcd2. --- samples/charts/area/line-boundaries.html | 3 +-- samples/charts/area/line-datasets.html | 6 ------ samples/charts/area/radar.html | 6 ------ samples/scriptable/bubble.html | 3 --- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/samples/charts/area/line-boundaries.html b/samples/charts/area/line-boundaries.html index 7ac6883bb12..c1ac1fc97eb 100644 --- a/samples/charts/area/line-boundaries.html +++ b/samples/charts/area/line-boundaries.html @@ -94,7 +94,7 @@ }); }); - // eslint-disable-next-line no-unused-vars + function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); Chart.helpers.each(Chart.instances, function(chart) { @@ -103,7 +103,6 @@ }); } - // eslint-disable-next-line no-unused-vars function randomize() { var seed = utils.rand(); Chart.helpers.each(Chart.instances, function(chart) { diff --git a/samples/charts/area/line-datasets.html b/samples/charts/area/line-datasets.html index 6a69345fa30..d232f0b90e7 100644 --- a/samples/charts/area/line-datasets.html +++ b/samples/charts/area/line-datasets.html @@ -134,24 +134,18 @@ options: options }); - - // eslint-disable-next-line no-unused-vars function togglePropagate(btn) { var value = btn.classList.toggle('btn-on'); chart.options.plugins.filler.propagate = value; chart.update(); } - - // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); } - - // eslint-disable-next-line no-unused-vars function randomize() { chart.data.datasets.forEach(function(dataset) { dataset.data = generateData(); diff --git a/samples/charts/area/radar.html b/samples/charts/area/radar.html index 33471436e95..6095de09856 100644 --- a/samples/charts/area/radar.html +++ b/samples/charts/area/radar.html @@ -112,24 +112,18 @@ options: options }); - - // eslint-disable-next-line no-unused-vars function togglePropagate(btn) { var value = btn.classList.toggle('btn-on'); chart.options.plugins.filler.propagate = value; chart.update(); } - - // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); } - - // eslint-disable-next-line no-unused-vars function randomize() { inputs.from = []; chart.data.datasets.forEach(function(dataset) { diff --git a/samples/scriptable/bubble.html b/samples/scriptable/bubble.html index a8ce1f4743c..421e7a9ecf2 100644 --- a/samples/scriptable/bubble.html +++ b/samples/scriptable/bubble.html @@ -105,7 +105,6 @@ options: options }); - // eslint-disable-next-line no-unused-vars function randomize() { chart.data.datasets.forEach(function(dataset) { dataset.data = generateData(); @@ -113,7 +112,6 @@ chart.update(); } - // eslint-disable-next-line no-unused-vars function addDataset() { chart.data.datasets.push({ data: generateData() @@ -121,7 +119,6 @@ chart.update(); } - // eslint-disable-next-line no-unused-vars function removeDataset() { chart.data.datasets.shift(); chart.update(); From 1474880963eb37cc21a6193ed4404709f72cd319 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Thu, 1 Feb 2018 20:19:47 +0000 Subject: [PATCH 37/41] Indentation --- samples/advanced/data-labelling.html | 212 ++++++------ samples/advanced/progress-bar.html | 158 ++++----- samples/charts/area/line-stacked.html | 6 +- samples/charts/bar/horizontal.html | 266 +++++++-------- samples/charts/bar/multi-axis.html | 32 +- samples/charts/bar/stacked-group.html | 184 +++++----- samples/charts/bar/stacked.html | 178 +++++----- samples/charts/bar/vertical.html | 258 +++++++------- samples/charts/bubble.html | 334 +++++++++---------- samples/charts/combo-bar-line.html | 176 +++++----- samples/charts/doughnut.html | 40 +-- samples/charts/line/basic.html | 286 ++++++++-------- samples/charts/line/interpolation-modes.html | 170 +++++----- samples/charts/line/line-styles.html | 196 +++++------ samples/charts/line/multi-axis.html | 32 +- samples/charts/line/point-sizes.html | 232 ++++++------- samples/charts/line/point-styles.html | 162 ++++----- samples/charts/line/skip-points.html | 162 ++++----- samples/charts/line/stepped.html | 128 +++---- samples/charts/pie.html | 22 +- samples/charts/polar-area.html | 32 +- samples/charts/radar-skip-points.html | 28 +- samples/charts/radar.html | 36 +- samples/charts/scatter/basic.html | 188 +++++------ samples/legend/point-style.html | 200 +++++------ samples/legend/positioning.html | 212 ++++++------ samples/scales/filtering-labels.html | 152 ++++----- samples/scales/gridlines-display.html | 204 +++++------ samples/scales/gridlines-style.html | 112 +++---- samples/scales/linear/min-max-suggested.html | 108 +++--- samples/scales/linear/min-max.html | 100 +++--- samples/scales/linear/step-size.html | 308 ++++++++--------- samples/scales/logarithmic/line.html | 156 ++++----- samples/scales/logarithmic/scatter.html | 310 ++++++++--------- samples/scales/multiline-labels.html | 148 ++++---- samples/scales/non-numeric-y.html | 116 +++---- samples/scales/time/combo.html | 6 +- samples/scales/time/line-point-data.html | 6 +- samples/scales/toggle-scale-type.html | 32 +- samples/tooltips/callbacks.html | 186 +++++------ samples/tooltips/custom-pie.html | 196 +++++------ 41 files changed, 3035 insertions(+), 3035 deletions(-) diff --git a/samples/advanced/data-labelling.html b/samples/advanced/data-labelling.html index a2be8666154..52eb07b8fd3 100644 --- a/samples/advanced/data-labelling.html +++ b/samples/advanced/data-labelling.html @@ -3,129 +3,129 @@ - Labelling Data Points - - - + -
- -
- - + }); + window.myBar.update(); + }); + diff --git a/samples/advanced/progress-bar.html b/samples/advanced/progress-bar.html index 30e5f1cecae..b97a998ea95 100644 --- a/samples/advanced/progress-bar.html +++ b/samples/advanced/progress-bar.html @@ -1,95 +1,95 @@ - Animation Callbacks - - - + -
- - -
-
-
- - + }); + + window.myLine.update(); + }); + diff --git a/samples/charts/area/line-stacked.html b/samples/charts/area/line-stacked.html index 57574c3906d..11a143b0b63 100644 --- a/samples/charts/area/line-stacked.html +++ b/samples/charts/area/line-stacked.html @@ -7,9 +7,9 @@ diff --git a/samples/charts/bar/horizontal.html b/samples/charts/bar/horizontal.html index 59a8d19d559..6450e014d92 100644 --- a/samples/charts/bar/horizontal.html +++ b/samples/charts/bar/horizontal.html @@ -2,148 +2,148 @@ - Horizontal Bar Chart - - - + Horizontal Bar Chart + + + -
- -
- - - - - - + }); + window.myHorizontalBar.update(); + }); + + var colorNames = Object.keys(window.chartColors); + + document.getElementById('addDataset').addEventListener('click', function() { + var colorName = colorNames[horizontalBarChartData.datasets.length % colorNames.length]; + var dsColor = window.chartColors[colorName]; + var newDataset = { + label: 'Dataset ' + horizontalBarChartData.datasets.length, + backgroundColor: color(dsColor).alpha(0.5).rgbString(), + borderColor: dsColor, + data: [] + }; + + for (var index = 0; index < horizontalBarChartData.labels.length; ++index) { + newDataset.data.push(randomScalingFactor()); + } + + horizontalBarChartData.datasets.push(newDataset); + window.myHorizontalBar.update(); + }); + + document.getElementById('addData').addEventListener('click', function() { + if (horizontalBarChartData.datasets.length > 0) { + var month = MONTHS[horizontalBarChartData.labels.length % MONTHS.length]; + horizontalBarChartData.labels.push(month); + + for (var index = 0; index < horizontalBarChartData.datasets.length; ++index) { + horizontalBarChartData.datasets[index].data.push(randomScalingFactor()); + } + + window.myHorizontalBar.update(); + } + }); + + document.getElementById('removeDataset').addEventListener('click', function() { + horizontalBarChartData.datasets.splice(0, 1); + window.myHorizontalBar.update(); + }); + + document.getElementById('removeData').addEventListener('click', function() { + horizontalBarChartData.labels.splice(-1, 1); // remove the label first + + horizontalBarChartData.datasets.forEach(function(dataset) { + dataset.data.pop(); + }); + + window.myHorizontalBar.update(); + }); + diff --git a/samples/charts/bar/multi-axis.html b/samples/charts/bar/multi-axis.html index 899bad5fb74..c206866a410 100644 --- a/samples/charts/bar/multi-axis.html +++ b/samples/charts/bar/multi-axis.html @@ -2,24 +2,24 @@ - Bar Chart Multi Axis - - - + Bar Chart Multi Axis + + + -
- -
- - + diff --git a/samples/charts/bar/stacked-group.html b/samples/charts/bar/stacked-group.html index 3fae6616eae..e3b734b2d17 100644 --- a/samples/charts/bar/stacked-group.html +++ b/samples/charts/bar/stacked-group.html @@ -2,104 +2,104 @@ - Stacked Bar Chart with Groups - - - + Stacked Bar Chart with Groups + + + -
- -
- - + }); + window.myBar.update(); + }); + diff --git a/samples/charts/bar/stacked.html b/samples/charts/bar/stacked.html index f21d7d44174..ca9f0cafb71 100644 --- a/samples/charts/bar/stacked.html +++ b/samples/charts/bar/stacked.html @@ -2,101 +2,101 @@ - Stacked Bar Chart - - - + Stacked Bar Chart + + + -
- -
- - + }); + window.myBar.update(); + }); + diff --git a/samples/charts/bar/vertical.html b/samples/charts/bar/vertical.html index c3311537e44..e9348b274fd 100644 --- a/samples/charts/bar/vertical.html +++ b/samples/charts/bar/vertical.html @@ -2,143 +2,143 @@ - Bar Chart - - - + Bar Chart + + + -
- -
- - - - - - + }); + window.myBar.update(); + }); + + var colorNames = Object.keys(window.chartColors); + document.getElementById('addDataset').addEventListener('click', function() { + var colorName = colorNames[barChartData.datasets.length % colorNames.length]; + var dsColor = window.chartColors[colorName]; + var newDataset = { + label: 'Dataset ' + barChartData.datasets.length, + backgroundColor: color(dsColor).alpha(0.5).rgbString(), + borderColor: dsColor, + borderWidth: 1, + data: [] + }; + + for (var index = 0; index < barChartData.labels.length; ++index) { + newDataset.data.push(randomScalingFactor()); + } + + barChartData.datasets.push(newDataset); + window.myBar.update(); + }); + + document.getElementById('addData').addEventListener('click', function() { + if (barChartData.datasets.length > 0) { + var month = MONTHS[barChartData.labels.length % MONTHS.length]; + barChartData.labels.push(month); + + for (var index = 0; index < barChartData.datasets.length; ++index) { + // window.myBar.addData(randomScalingFactor(), index); + barChartData.datasets[index].data.push(randomScalingFactor()); + } + + window.myBar.update(); + } + }); + + document.getElementById('removeDataset').addEventListener('click', function() { + barChartData.datasets.splice(0, 1); + window.myBar.update(); + }); + + document.getElementById('removeData').addEventListener('click', function() { + barChartData.labels.splice(-1, 1); // remove the label first + + barChartData.datasets.forEach(function(dataset) { + dataset.data.pop(); + }); + + window.myBar.update(); + }); + diff --git a/samples/charts/bubble.html b/samples/charts/bubble.html index 25cf8050d97..092c1fb464b 100644 --- a/samples/charts/bubble.html +++ b/samples/charts/bubble.html @@ -2,190 +2,190 @@ - Bubble Chart - - - + -
- -
- - - - - - + window.myChart.update(); + } + }); + + document.getElementById('removeDataset').addEventListener('click', function() { + bubbleChartData.datasets.splice(0, 1); + window.myChart.update(); + }); + + document.getElementById('removeData').addEventListener('click', function() { + bubbleChartData.datasets.forEach(function(dataset) { + dataset.data.pop(); + }); + + window.myChart.update(); + }); + diff --git a/samples/charts/combo-bar-line.html b/samples/charts/combo-bar-line.html index 49c1aad8a7d..c99894e2212 100644 --- a/samples/charts/combo-bar-line.html +++ b/samples/charts/combo-bar-line.html @@ -2,100 +2,100 @@ - Combo Bar-Line Chart - - - + Combo Bar-Line Chart + + + -
- -
- - + }); + window.myMixedChart.update(); + }); + diff --git a/samples/charts/doughnut.html b/samples/charts/doughnut.html index 8e24dde4c73..446dcee4e2e 100644 --- a/samples/charts/doughnut.html +++ b/samples/charts/doughnut.html @@ -2,28 +2,28 @@ - Doughnut Chart - - - + Doughnut Chart + + + -
- -
- - - - - - + diff --git a/samples/charts/line/basic.html b/samples/charts/line/basic.html index 4f026607daf..8028bee9c51 100644 --- a/samples/charts/line/basic.html +++ b/samples/charts/line/basic.html @@ -2,162 +2,162 @@ - Line Chart - - - + Line Chart + + + -
- -
-
-
- - - - - - + window.myLine.update(); + }); + diff --git a/samples/charts/line/interpolation-modes.html b/samples/charts/line/interpolation-modes.html index 09d7e83c81a..b11dd681972 100644 --- a/samples/charts/line/interpolation-modes.html +++ b/samples/charts/line/interpolation-modes.html @@ -2,102 +2,102 @@ - Line Chart - Cubic interpolation mode - - - + Line Chart - Cubic interpolation mode + + + -
- -
-
-
- - + diff --git a/samples/charts/line/line-styles.html b/samples/charts/line/line-styles.html index ab8f76f0822..3ba9defcdaf 100644 --- a/samples/charts/line/line-styles.html +++ b/samples/charts/line/line-styles.html @@ -2,110 +2,110 @@ - Line Styles - - - + Line Styles + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/charts/line/multi-axis.html b/samples/charts/line/multi-axis.html index 8088f8a1b03..d3569e85525 100644 --- a/samples/charts/line/multi-axis.html +++ b/samples/charts/line/multi-axis.html @@ -2,24 +2,24 @@ - Line Chart Multiple Axes - - - + Line Chart Multiple Axes + + + -
- -
- - + diff --git a/samples/charts/line/point-sizes.html b/samples/charts/line/point-sizes.html index eca0a08cdd2..53d3db46cbb 100644 --- a/samples/charts/line/point-sizes.html +++ b/samples/charts/line/point-sizes.html @@ -2,128 +2,128 @@ - Different Point Sizes - - - + Different Point Sizes + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/charts/line/point-styles.html b/samples/charts/line/point-styles.html index 2198e47f48b..2ef46a9cf35 100644 --- a/samples/charts/line/point-styles.html +++ b/samples/charts/line/point-styles.html @@ -2,95 +2,95 @@ - Line Chart - - - + Line Chart + + + -
-
- + var ctx = canvas.getContext('2d'); + var config = createConfig(pointStyle); + new Chart(ctx, config); + }); + }; + diff --git a/samples/charts/line/skip-points.html b/samples/charts/line/skip-points.html index a473e65b4a8..aedacce7244 100644 --- a/samples/charts/line/skip-points.html +++ b/samples/charts/line/skip-points.html @@ -2,94 +2,94 @@ - Line Chart - - - + Line Chart + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/charts/line/stepped.html b/samples/charts/line/stepped.html index ffdfcc7ac4c..4ad9708ebd1 100644 --- a/samples/charts/line/stepped.html +++ b/samples/charts/line/stepped.html @@ -2,9 +2,9 @@ - Stepped Line Chart - - + Stepped Line Chart + + + -
- -
- - - - + diff --git a/samples/charts/radar-skip-points.html b/samples/charts/radar-skip-points.html index 7b979216058..ab042e2dcd6 100644 --- a/samples/charts/radar-skip-points.html +++ b/samples/charts/radar-skip-points.html @@ -2,24 +2,24 @@ - Radar Chart - - - + -
- -
- - + diff --git a/samples/charts/radar.html b/samples/charts/radar.html index b39389cf772..7eda09a7fb4 100644 --- a/samples/charts/radar.html +++ b/samples/charts/radar.html @@ -2,28 +2,28 @@ - Radar Chart - - - + -
- -
- - - - - - + diff --git a/samples/charts/scatter/basic.html b/samples/charts/scatter/basic.html index 58ccb232cd2..6ac227c3b95 100644 --- a/samples/charts/scatter/basic.html +++ b/samples/charts/scatter/basic.html @@ -2,106 +2,106 @@ - Scatter Chart - - - + Scatter Chart + + + -
- -
- - + }); + window.myScatter.update(); + }); + diff --git a/samples/legend/point-style.html b/samples/legend/point-style.html index cc4c2b7bdd8..b7acea4bd84 100644 --- a/samples/legend/point-style.html +++ b/samples/legend/point-style.html @@ -2,115 +2,115 @@ - Legend Point Style - - - + Legend Point Style + + + -
-
- -
-
- -
+
+
+
- + window.onload = function() { + [{ + id: 'chart-legend-normal', + config: createConfig('red') + }, { + id: 'chart-legend-pointstyle', + config: createPointStyleConfig('blue') + }].forEach(function(details) { + var ctx = document.getElementById(details.id).getContext('2d'); + new Chart(ctx, details.config); + }); + }; + diff --git a/samples/legend/positioning.html b/samples/legend/positioning.html index e7ec5e6abf1..5bd2259cfb1 100644 --- a/samples/legend/positioning.html +++ b/samples/legend/positioning.html @@ -2,120 +2,120 @@ - Legend Positions - - - + Legend Positions + + + -
-
- -
-
- -
-
- -
-
- -
+
+
+ +
+
+
- + window.onload = function() { + [{ + id: 'chart-legend-top', + legendPosition: 'top', + color: 'red' + }, { + id: 'chart-legend-right', + legendPosition: 'right', + color: 'blue' + }, { + id: 'chart-legend-bottom', + legendPosition: 'bottom', + color: 'green' + }, { + id: 'chart-legend-left', + legendPosition: 'left', + color: 'yellow' + }].forEach(function(details) { + var ctx = document.getElementById(details.id).getContext('2d'); + var config = createConfig(details.legendPosition, details.color); + new Chart(ctx, config); + }); + }; + diff --git a/samples/scales/filtering-labels.html b/samples/scales/filtering-labels.html index cb820e37987..4b4b51724e4 100644 --- a/samples/scales/filtering-labels.html +++ b/samples/scales/filtering-labels.html @@ -2,90 +2,90 @@ - Chart with xAxis Filtering - - - + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/gridlines-display.html b/samples/scales/gridlines-display.html index d973d2670bf..8e30bdcdbf4 100644 --- a/samples/scales/gridlines-display.html +++ b/samples/scales/gridlines-display.html @@ -2,123 +2,123 @@ - Grid Lines Display Settings - - - + -
- + var ctx = canvas.getContext('2d'); + var config = createConfig(details.gridLines, details.title); + new Chart(ctx, config); + }); + }; + diff --git a/samples/scales/gridlines-style.html b/samples/scales/gridlines-style.html index db12d61e644..d2c00ecdda2 100644 --- a/samples/scales/gridlines-style.html +++ b/samples/scales/gridlines-style.html @@ -2,68 +2,68 @@ - Grid Lines Style Settings - - - + Grid Lines Style Settings + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/linear/min-max-suggested.html b/samples/scales/linear/min-max-suggested.html index 98379918f25..10d546ac297 100644 --- a/samples/scales/linear/min-max-suggested.html +++ b/samples/scales/linear/min-max-suggested.html @@ -2,66 +2,66 @@ - Suggested Min/Max Settings - - - + Suggested Min/Max Settings + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/linear/min-max.html b/samples/scales/linear/min-max.html index 47333506866..feafbd7a62c 100644 --- a/samples/scales/linear/min-max.html +++ b/samples/scales/linear/min-max.html @@ -2,63 +2,63 @@ - Min/Max Settings - - - + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/linear/step-size.html b/samples/scales/linear/step-size.html index 996d146c7ed..fc0af2ee3e0 100644 --- a/samples/scales/linear/step-size.html +++ b/samples/scales/linear/step-size.html @@ -2,174 +2,174 @@ - Line Chart - - - + Line Chart + + + -
- -
-
-
- - - - - - + diff --git a/samples/scales/logarithmic/line.html b/samples/scales/logarithmic/line.html index c8819e89fac..72fd9b07dba 100644 --- a/samples/scales/logarithmic/line.html +++ b/samples/scales/logarithmic/line.html @@ -2,96 +2,96 @@ - Logarithmic Line Chart - - - + Logarithmic Line Chart + + + -
- -
- - + + window.myLine.update(); + }); + diff --git a/samples/scales/logarithmic/scatter.html b/samples/scales/logarithmic/scatter.html index 8b46b09b99b..5f266a5cda1 100644 --- a/samples/scales/logarithmic/scatter.html +++ b/samples/scales/logarithmic/scatter.html @@ -2,170 +2,170 @@ - Scatter Chart - - - + Scatter Chart + + + -
- -
- + } + }); + }; + diff --git a/samples/scales/multiline-labels.html b/samples/scales/multiline-labels.html index 9d381fb5a56..0f8af2a7df1 100644 --- a/samples/scales/multiline-labels.html +++ b/samples/scales/multiline-labels.html @@ -2,85 +2,85 @@ - Line Chart - - - + Line Chart + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/non-numeric-y.html b/samples/scales/non-numeric-y.html index b1e1d8034c1..b3bfc5eec92 100644 --- a/samples/scales/non-numeric-y.html +++ b/samples/scales/non-numeric-y.html @@ -2,71 +2,71 @@ - Line Chart - - - + Line Chart + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/scales/time/combo.html b/samples/scales/time/combo.html index f070b7f2a0d..d435e74c69c 100644 --- a/samples/scales/time/combo.html +++ b/samples/scales/time/combo.html @@ -8,9 +8,9 @@ diff --git a/samples/scales/time/line-point-data.html b/samples/scales/time/line-point-data.html index 71ab8bfc5c3..e18be91f3d8 100644 --- a/samples/scales/time/line-point-data.html +++ b/samples/scales/time/line-point-data.html @@ -8,9 +8,9 @@ diff --git a/samples/scales/toggle-scale-type.html b/samples/scales/toggle-scale-type.html index d7e602ad0e0..92c943288e3 100644 --- a/samples/scales/toggle-scale-type.html +++ b/samples/scales/toggle-scale-type.html @@ -2,24 +2,24 @@ - Toggle Scale Type - - - + Toggle Scale Type + + + -
- -
- - + diff --git a/samples/tooltips/callbacks.html b/samples/tooltips/callbacks.html index 31097ca8d6d..0aa336bd5f3 100644 --- a/samples/tooltips/callbacks.html +++ b/samples/tooltips/callbacks.html @@ -2,106 +2,106 @@ - Tooltip Hooks - - - + Tooltip Hooks + + + -
- -
- + window.onload = function() { + var ctx = document.getElementById('canvas').getContext('2d'); + window.myLine = new Chart(ctx, config); + }; + diff --git a/samples/tooltips/custom-pie.html b/samples/tooltips/custom-pie.html index 5e1361aac45..017a5f66d84 100644 --- a/samples/tooltips/custom-pie.html +++ b/samples/tooltips/custom-pie.html @@ -2,15 +2,15 @@ - Pie Chart with Custom Tooltips - - + Pie Chart with Custom Tooltips + + - + @@ -43,103 +43,103 @@
From 57fc01cced6b1a84e8ef543c8a2d16892b124917 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Thu, 1 Feb 2018 22:15:51 +0000 Subject: [PATCH 38/41] Remove old htmlTask --- gulpfile.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index ec4fde6030a..21f19645f81 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -56,7 +56,6 @@ gulp.task('docs', docsTask); gulp.task('test', ['lint', 'unittest']); gulp.task('size', ['library-size', 'module-sizes']); gulp.task('server', serverTask); -gulp.task('validHTML', validHTMLTask); gulp.task('unittest', unittestTask); gulp.task('library-size', librarySizeTask); gulp.task('module-sizes', moduleSizesTask); @@ -199,11 +198,6 @@ function docsTask(done) { }); } -function validHTMLTask() { - return gulp.src('samples/*.html') - .pipe(htmlv()); -} - function startTest() { return [ {pattern: './test/fixtures/**/*.json', included: false}, From 4a2ff8c1ab40108b5e1f572335089a3f50efaeda Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Thu, 1 Feb 2018 22:16:12 +0000 Subject: [PATCH 39/41] Fix package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1b48d7c8cb7..03f3815ccd7 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "gulp-connect": "~5.0.0", "gulp-eslint": "^4.0.0", "gulp-file": "^0.3.0", - "gulp-htmllint": "0.0.15", + "gulp-htmllint": "^0.0.15", "gulp-insert": "~0.5.0", "gulp-replace": "^0.6.1", "gulp-size": "~2.1.0", From 03321b006bb98841c06feee873dcfffe28874f62 Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Thu, 1 Feb 2018 22:16:28 +0000 Subject: [PATCH 40/41] Fix plugin id --- samples/charts/area/analyser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/charts/area/analyser.js b/samples/charts/area/analyser.js index e4ed8e90b24..36fd5671692 100644 --- a/samples/charts/area/analyser.js +++ b/samples/charts/area/analyser.js @@ -4,7 +4,7 @@ (function() { Chart.plugins.register({ - id: 'samples_filler_analyser', + id: 'samples-filler-analyser', beforeInit: function(chart, options) { this.element = document.getElementById(options.target); From 58db09d9b2e82da1db88b7e0f25170eb1be17bad Mon Sep 17 00:00:00 2001 From: loicbourgois Date: Fri, 2 Feb 2018 13:01:12 +0000 Subject: [PATCH 41/41] eslint-disable-next-line no-unused-vars --- samples/charts/area/line-boundaries.html | 3 ++- samples/charts/area/line-datasets.html | 3 +++ samples/charts/area/radar.html | 3 +++ samples/scriptable/bubble.html | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/samples/charts/area/line-boundaries.html b/samples/charts/area/line-boundaries.html index c1ac1fc97eb..7ac6883bb12 100644 --- a/samples/charts/area/line-boundaries.html +++ b/samples/charts/area/line-boundaries.html @@ -94,7 +94,7 @@ }); }); - + // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); Chart.helpers.each(Chart.instances, function(chart) { @@ -103,6 +103,7 @@ }); } + // eslint-disable-next-line no-unused-vars function randomize() { var seed = utils.rand(); Chart.helpers.each(Chart.instances, function(chart) { diff --git a/samples/charts/area/line-datasets.html b/samples/charts/area/line-datasets.html index d232f0b90e7..127726e7fb7 100644 --- a/samples/charts/area/line-datasets.html +++ b/samples/charts/area/line-datasets.html @@ -134,18 +134,21 @@ options: options }); + // eslint-disable-next-line no-unused-vars function togglePropagate(btn) { var value = btn.classList.toggle('btn-on'); chart.options.plugins.filler.propagate = value; chart.update(); } + // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); } + // eslint-disable-next-line no-unused-vars function randomize() { chart.data.datasets.forEach(function(dataset) { dataset.data = generateData(); diff --git a/samples/charts/area/radar.html b/samples/charts/area/radar.html index 6095de09856..692984cbfd7 100644 --- a/samples/charts/area/radar.html +++ b/samples/charts/area/radar.html @@ -112,18 +112,21 @@ options: options }); + // eslint-disable-next-line no-unused-vars function togglePropagate(btn) { var value = btn.classList.toggle('btn-on'); chart.options.plugins.filler.propagate = value; chart.update(); } + // eslint-disable-next-line no-unused-vars function toggleSmooth(btn) { var value = btn.classList.toggle('btn-on'); chart.options.elements.line.tension = value ? 0.4 : 0.000001; chart.update(); } + // eslint-disable-next-line no-unused-vars function randomize() { inputs.from = []; chart.data.datasets.forEach(function(dataset) { diff --git a/samples/scriptable/bubble.html b/samples/scriptable/bubble.html index 421e7a9ecf2..a8ce1f4743c 100644 --- a/samples/scriptable/bubble.html +++ b/samples/scriptable/bubble.html @@ -105,6 +105,7 @@ options: options }); + // eslint-disable-next-line no-unused-vars function randomize() { chart.data.datasets.forEach(function(dataset) { dataset.data = generateData(); @@ -112,6 +113,7 @@ chart.update(); } + // eslint-disable-next-line no-unused-vars function addDataset() { chart.data.datasets.push({ data: generateData() @@ -119,6 +121,7 @@ chart.update(); } + // eslint-disable-next-line no-unused-vars function removeDataset() { chart.data.datasets.shift(); chart.update();