From ccf1578308645cf1643987f64b6dc7c53245e307 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Mon, 9 Dec 2013 20:59:40 +0100 Subject: [PATCH 01/17] added some tags to the plugins.jquery.com file --- highchartTable.jquery.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/highchartTable.jquery.json b/highchartTable.jquery.json index a32a5c0..272f0cb 100644 --- a/highchartTable.jquery.json +++ b/highchartTable.jquery.json @@ -15,7 +15,10 @@ "keywords": [ "highcharts", "chart", - "table" + "table", + "ui", + "graphics", + "graphs" ], "bugs": "https://github.com/highchartTable/jquery-highchartTable-plugin/issues", "homepage": "http://highcharttable.org/", From 8f3397e94ce9abf34ba911d49000afe77714367b Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Mon, 9 Dec 2013 21:00:27 +0100 Subject: [PATCH 02/17] update project version to 1.0.2 --- highchartTable.jquery.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highchartTable.jquery.json b/highchartTable.jquery.json index 272f0cb..3cdf56b 100644 --- a/highchartTable.jquery.json +++ b/highchartTable.jquery.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.1", + "version": "1.0.2", "title": "highchartTable", "licenses": [ { From 7652f8bb8dd2ce8ee44e9183363995f7a117093a Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Thu, 30 Jan 2014 23:50:01 +0100 Subject: [PATCH 03/17] Add bower.json --- bower.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 bower.json diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..8a51742 --- /dev/null +++ b/bower.json @@ -0,0 +1,26 @@ +{ + "name": "highchartTable", + "version": "1.0.2", + "homepage": "https://github.com/highchartTable/jquery-highchartTable-plugin", + "description": "This jQuery plugin provides a simple way to convert HTML data tables to Highcharts graphs.", + "main": "jquery.highchartTable.js", + "keywords": [ + "highcharts", + "chart", + "table", + "ui", + "graphics", + "graphs" + ], + "license": "MIT", + "ignore": [ + "bower.json", + "highchartTable.jquery.json", + "LICENCE", + "README.md" + ], + "dependencies": { + "highcharts": "*", + "jquery": "*" + } +} From 8957608d4af7f9e62ed887813013dd16cad336f5 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sat, 1 Feb 2014 22:07:31 +0100 Subject: [PATCH 04/17] move to version 1.0.3 --- bower.json | 2 +- highchartTable.jquery.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index 8a51742..f29a7c2 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.2", + "version": "1.0.3", "homepage": "https://github.com/highchartTable/jquery-highchartTable-plugin", "description": "This jQuery plugin provides a simple way to convert HTML data tables to Highcharts graphs.", "main": "jquery.highchartTable.js", diff --git a/highchartTable.jquery.json b/highchartTable.jquery.json index 3cdf56b..e9ac7aa 100644 --- a/highchartTable.jquery.json +++ b/highchartTable.jquery.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.2", + "version": "1.0.3", "title": "highchartTable", "licenses": [ { From 85fa8397666fe5f1d70f09cf3beb1fa0019089b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20L=C3=A9v=C3=AAque?= Date: Mon, 17 Feb 2014 23:14:18 +0100 Subject: [PATCH 05/17] Remove all blank characters --- jquery.highchartTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.highchartTable.js b/jquery.highchartTable.js index 031da37..40a0e81 100644 --- a/jquery.highchartTable.js +++ b/jquery.highchartTable.js @@ -221,7 +221,7 @@ serie.data.push(null); } } else { - var cleanedCellValue = rawCellValue.replace(/ /g, '').replace(/,/, '.'); + var cleanedCellValue = rawCellValue.replace(/\s/g, '').replace(/,/, '.'); cellValue = Math.round(parseFloat(cleanedCellValue) * column.scale * 100) / 100; var dataGraphX = $td.data('graph-x'); From 3ac91be9a575c0c129d6d7cd4bbc383f1a31fba8 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Wed, 19 Feb 2014 21:41:47 +0100 Subject: [PATCH 06/17] use Grunt to bump versions --- .gitignore | 1 + Gruntfile.js | 21 +++++++++++++++++++++ package.json | 7 +++++++ 3 files changed, 29 insertions(+) create mode 100644 .gitignore create mode 100644 Gruntfile.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07e6e47 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/node_modules diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..6da468d --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,21 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + + bump: { + options: { + files: ['bower.json', 'highchartTable.jquery.json', 'package.json'], + commit: true, + commitMessage: 'Release v%VERSION%', + commitFiles: ['bower.json', 'highchartTable.jquery.json', 'package.json'], + createTag: true, + tagName: '%VERSION%', + tagMessage: 'Version %VERSION%', + push: false + } + } + + }); + grunt.loadNpmTasks('grunt-bump'); + +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..6f46ef4 --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "name": "highchartTable", + "version": "1.0.3", + "devDependencies": { + "grunt-bump": "0.0.13" + } +} From aee5b68bf2cf72ae28500fb8acd068e44d9de111 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Wed, 19 Feb 2014 21:50:16 +0100 Subject: [PATCH 07/17] Release v1.0.4 --- bower.json | 2 +- highchartTable.jquery.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index f29a7c2..cd63568 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.3", + "version": "1.0.4", "homepage": "https://github.com/highchartTable/jquery-highchartTable-plugin", "description": "This jQuery plugin provides a simple way to convert HTML data tables to Highcharts graphs.", "main": "jquery.highchartTable.js", diff --git a/highchartTable.jquery.json b/highchartTable.jquery.json index e9ac7aa..fefcc05 100644 --- a/highchartTable.jquery.json +++ b/highchartTable.jquery.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.3", + "version": "1.0.4", "title": "highchartTable", "licenses": [ { diff --git a/package.json b/package.json index 6f46ef4..8dd254e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.3", + "version": "1.0.4", "devDependencies": { "grunt-bump": "0.0.13" } From a7b806e117f6a49268c4ef637393a9d7d5cec3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agne=CC=80s=20Haasser?= Date: Mon, 12 Jan 2015 17:24:06 +0100 Subject: [PATCH 08/17] Mod: allow many theme colors --- jquery.highchartTable.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jquery.highchartTable.js b/jquery.highchartTable.js index 40a0e81..3c03126 100644 --- a/jquery.highchartTable.js +++ b/jquery.highchartTable.js @@ -315,7 +315,8 @@ var lineShadow = $table.data('graph-line-shadow'); var lineWidth = $table.data('graph-line-width') || 2; - for(var i=0; i<9; i++) { + var nbOfColors = Math.max(defaultColors.length, themeColors.length); + for(var i=0; i < nbOfColors; i++) { var dataname = 'graph-color-' + (i+1); colors.push(typeof $table.data(dataname) != 'undefined' ? $table.data(dataname) : typeof themeColors[i] != 'undefined' ? themeColors[i] : defaultColors[i]); } From 3456a131269e2fcc62f9413b13104798bfcdde14 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sat, 14 Feb 2015 14:15:04 +0100 Subject: [PATCH 09/17] Release v1.1.0 --- bower.json | 2 +- highchartTable.jquery.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index cd63568..96670dd 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.4", + "version": "1.1.0", "homepage": "https://github.com/highchartTable/jquery-highchartTable-plugin", "description": "This jQuery plugin provides a simple way to convert HTML data tables to Highcharts graphs.", "main": "jquery.highchartTable.js", diff --git a/highchartTable.jquery.json b/highchartTable.jquery.json index fefcc05..0990ecf 100644 --- a/highchartTable.jquery.json +++ b/highchartTable.jquery.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.4", + "version": "1.1.0", "title": "highchartTable", "licenses": [ { diff --git a/package.json b/package.json index 8dd254e..f2219ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "highchartTable", - "version": "1.0.4", + "version": "1.1.0", "devDependencies": { "grunt-bump": "0.0.13" } From 55bec567b132fd36a5ae117780520d9037a0db06 Mon Sep 17 00:00:00 2001 From: des2k7 Date: Tue, 5 May 2015 11:24:27 +0200 Subject: [PATCH 10/17] xaxis label autorotation fix use undefined rather than 0 or center. --- jquery.highchartTable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.highchartTable.js b/jquery.highchartTable.js index 3c03126..6eb8502 100644 --- a/jquery.highchartTable.js +++ b/jquery.highchartTable.js @@ -381,8 +381,8 @@ }, labels: { - rotation: $table.data('graph-xaxis-rotation') || 0, - align: $table.data('graph-xaxis-align') || 'center', + rotation: $table.data('graph-xaxis-rotation') || undefined, + align: $table.data('graph-xaxis-align') || undefined, enabled: typeof xAxisLabelsEnabled != 'undefined' ? xAxisLabelsEnabled : true, style: xAxisLabelStyle }, From b4284202374fa9b47164b071934cc523c03422b7 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sun, 7 Jun 2015 23:25:53 +0200 Subject: [PATCH 11/17] add event to customize cleaning of cell values Exemple of usage : ``` $('table.highchart') .on('highchartTable.cleanValue', function(value, options) { if (options.indexTr == 0) { options.value = options.value.replace(/\$/, ''); } }) .highchartTable() ``` List of options passed to the event : * value (that's the one that must be changed, contains the value already cleaned by HighchartTable) * rawValue : the value not cleaned by HighchartTable * td : jQuery objet of the td were the valued is extracted from * tr : jQuery objet of the tr where is td is readed from * indexTr : index of the tr (starts at 0) * indexTd : index of the td (starts at 1) --- jquery.highchartTable.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jquery.highchartTable.js b/jquery.highchartTable.js index 3c03126..e772ce2 100644 --- a/jquery.highchartTable.js +++ b/jquery.highchartTable.js @@ -222,7 +222,16 @@ } } else { var cleanedCellValue = rawCellValue.replace(/\s/g, '').replace(/,/, '.'); - cellValue = Math.round(parseFloat(cleanedCellValue) * column.scale * 100) / 100; + var eventOptions = { + value: cleanedCellValue, + rawValue: rawCellValue, + td: $td, + tr: $(row), + indexTd: indexTd, + indexTr: indexRow + } + $table.trigger('highchartTable.cleanValue', eventOptions); + cellValue = Math.round(parseFloat(eventOptions.value) * column.scale * 100) / 100; var dataGraphX = $td.data('graph-x'); From 74cb45263012aaa372ee77ce5e98a2456b7438f2 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sat, 14 Nov 2015 01:15:58 +0100 Subject: [PATCH 12/17] add first tests on highchartTable --- .travis.yml | 6 +++ karma.conf-ci.js | 100 ++++++++++++++++++++++++++++++++++++++++++++++ karma.conf.js | 72 +++++++++++++++++++++++++++++++++ package.json | 10 ++++- tests/baseSpec.js | 60 ++++++++++++++++++++++++++++ 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100644 karma.conf-ci.js create mode 100644 karma.conf.js create mode 100644 tests/baseSpec.js diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..765671d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - '0.11' +env: + - JQUERY_VERSION=1.11.3 HIGHCHARTS_VERSION=2.2.4 + - JQUERY_VERSION=1.11.1 HIGHCHARTS_VERSION=2.2.4 diff --git a/karma.conf-ci.js b/karma.conf-ci.js new file mode 100644 index 0000000..64f93b3 --- /dev/null +++ b/karma.conf-ci.js @@ -0,0 +1,100 @@ +// Karma configuration +// Generated on Wed Nov 11 2015 19:12:34 GMT+0100 (CET) + +module.exports = function(config) { + + var jqueryVersion = process.env.JQUERY_VERSION; + var highchartsVersion = process.env.HIGHCHARTS_VERSION; + + // Browsers to run on Sauce Labs + var customLaunchers = { + 'SL_Chrome': { + base: 'SauceLabs', + browserName: 'chrome' + }, + 'SL_InternetExplorer': { + base: 'SauceLabs', + browserName: 'internet explorer', + version: '10' + }, + 'SL_FireFox': { + base: 'SauceLabs', + browserName: 'firefox', + version: '37' + } + }; + + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'http://code.jquery.com/jquery-' + jqueryVersion + '.min.js', + 'http://code.highcharts.com/' + highchartsVersion + '/highcharts.js', + 'jquery.highchartTable.js', + 'tests/*Spec.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress', 'saucelabs'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + sauceLabs: { + testName: 'HighchartTable tests / jquery ' + jqueryVersion + ' / highcharts ' + highchartsVersion + }, + + captureTimeout: 120000, + customLaunchers: customLaunchers, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: Object.keys(customLaunchers), + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultanous + concurrency: Infinity + }) +} diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..fb0d04d --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,72 @@ +// Karma configuration +// Generated on Wed Nov 11 2015 19:12:34 GMT+0100 (CET) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'http://code.jquery.com/jquery-1.11.3.min.js', + 'http://code.highcharts.com/2.2.4/highcharts.js', + 'jquery.highchartTable.js', + 'tests/*Spec.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['Chrome'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultanous + concurrency: Infinity + }) +} diff --git a/package.json b/package.json index f2219ef..c6fa33e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,15 @@ { "name": "highchartTable", "version": "1.1.0", + "scripts": { + "test": "./node_modules/karma/bin/karma start karma.conf-ci.js" + }, "devDependencies": { - "grunt-bump": "0.0.13" + "grunt-bump": "0.0.13", + "jasmine-core": "^2.3.4", + "karma": "^0.13.15", + "karma-chrome-launcher": "^0.2.1", + "karma-jasmine": "^0.3.6", + "karma-sauce-launcher": "^0.3.0" } } diff --git a/tests/baseSpec.js b/tests/baseSpec.js new file mode 100644 index 0000000..dc50b39 --- /dev/null +++ b/tests/baseSpec.js @@ -0,0 +1,60 @@ + +describe("Base test", function() { + + var fixture; + + + beforeEach(function() { + var htmlContent = ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' '; + + $('#fixture').remove(); + $('body').append(htmlContent); + }); + + + it("Simple table", function() { + + var beforeRenderCalled = false; + + $('table') + .bind('highchartTable.beforeRender', function(event, highChartConfig) { + beforeRenderCalled = true; + expect(highChartConfig.title.text).toBe("Example of title"); + expect(highChartConfig.series[0].type).toBe("column"); + expect(highChartConfig.series[0].data[0].name).toBe('8000'); + expect(highChartConfig.series[0].data[0].y).toBe(8000); + expect(highChartConfig.series[0].data[1].name).toBe('12000'); + expect(highChartConfig.series[0].data[1].y).toBe(12000); + expect(highChartConfig.series[0].data[2].name).toBe('18000'); + expect(highChartConfig.series[0].data[2].y).toBe(18000); + }) + .highchartTable() + ; + + expect(beforeRenderCalled).toBe(true); + }); +}); + + From 8f928972add555a4e978ee8d5c534b720206aca5 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sun, 15 Nov 2015 09:56:40 +0100 Subject: [PATCH 13/17] add test status badge on README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ecd2023..2173dd8 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,5 @@ Welcome to jQuery HighchartTable plugin :) This plugin provides you a simple way to convert HTML data tables to Highcharts graphs. You will find more information here : http://highcharttable.org/ + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/hIghcharttable.svg)](https://saucelabs.com/u/hIghcharttable) From e640b5e0bcc4b55789d159c77f5a374e24337fec Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sun, 15 Nov 2015 10:10:13 +0100 Subject: [PATCH 14/17] fix yaxis attributes on jquery2 `data-graph-yaxis-X-*` attributes doesn't work on jQuery 2 (but `data-graph-yaxisX-*` work). `data-graph-yaxis-X-*` works on the master branch of jQuery. In order to have a version that work on all jQury versions we have to support the `data-graph-yaxisX-*` version that will be the new norm. To avoid a Backward compatibility break, we need to support both versions of the attribute. * Now all `data-graph-yaxis` attributes could be written with or without a dash before the axis number. * There is tests on all the attributes, in both versions * tests are executed on both jQuery 2 and jQuery 1 see issue #60 --- .travis.yml | 2 +- jquery.highchartTable.js | 36 +++++--- tests/baseSpec.js | 22 ++++- tests/yaxisAttributesSpec.js | 155 +++++++++++++++++++++++++++++++++++ 4 files changed, 200 insertions(+), 15 deletions(-) create mode 100644 tests/yaxisAttributesSpec.js diff --git a/.travis.yml b/.travis.yml index 765671d..cc4105b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ node_js: - '0.11' env: - JQUERY_VERSION=1.11.3 HIGHCHARTS_VERSION=2.2.4 - - JQUERY_VERSION=1.11.1 HIGHCHARTS_VERSION=2.2.4 + - JQUERY_VERSION=2.1.4 HIGHCHARTS_VERSION=2.2.4 diff --git a/jquery.highchartTable.js b/jquery.highchartTable.js index 3c03126..3f07b25 100644 --- a/jquery.highchartTable.js +++ b/jquery.highchartTable.js @@ -265,30 +265,44 @@ }); + var getYaxisAttr = function($table, yAxisNum, name) { + var oldConvention = $table.data('graph-yaxis-' + yAxisNum + '-' + name); + if (typeof oldConvention != 'undefined') { + return oldConvention; + } + + return $table.data('graph-yaxis' + yAxisNum + '-' + name); + }; + var yAxisConfig = []; var yAxisNum; for (yAxisNum=1 ; yAxisNum <= nbYaxis ; yAxisNum++) { var yAxisConfigCurrentAxis = { title: { - text: typeof $table.data('graph-yaxis-'+yAxisNum+'-title-text') != 'undefined' ? $table.data('graph-yaxis-'+yAxisNum+'-title-text') : null + text: typeof getYaxisAttr($table, yAxisNum, 'title-text') != 'undefined' ? getYaxisAttr($table, yAxisNum, 'title-text') : null }, - max: typeof $table.data('graph-yaxis-'+yAxisNum+'-max') != 'undefined' ? $table.data('graph-yaxis-'+yAxisNum+'-max') : null, - min: typeof $table.data('graph-yaxis-'+yAxisNum+'-min') != 'undefined' ? $table.data('graph-yaxis-'+yAxisNum+'-min') : null, - reversed: $table.data('graph-yaxis-'+yAxisNum+'-reversed') == '1', - opposite: $table.data('graph-yaxis-'+yAxisNum+'-opposite') == '1', - tickInterval: $table.data('graph-yaxis-'+yAxisNum+'-tick-interval') || null, + max: typeof getYaxisAttr($table, yAxisNum, 'max') != 'undefined' ? getYaxisAttr($table, yAxisNum, 'max') : null, + min: typeof getYaxisAttr($table, yAxisNum, 'min') != 'undefined' ? getYaxisAttr($table, yAxisNum, 'min') : null, + reversed: getYaxisAttr($table, yAxisNum, 'reversed') == '1', + opposite: getYaxisAttr($table, yAxisNum, 'opposite') == '1', + tickInterval: getYaxisAttr($table, yAxisNum, 'tick-interval') || null, labels: { - rotation: $table.data('graph-yaxis-'+yAxisNum+'-rotation') || 0 + rotation: getYaxisAttr($table, yAxisNum, 'rotation') || 0 }, - startOnTick: $table.data('graph-yaxis-'+yAxisNum+'-start-on-tick') !== "0", - endOnTick: $table.data('graph-yaxis-'+yAxisNum+'-end-on-tick') !== "0", + startOnTick: getYaxisAttr($table, yAxisNum, 'start-on-tick') != "0", + endOnTick: getYaxisAttr($table, yAxisNum, 'end-on-tick') != "0", stackLabels : { - enabled: $table.data('graph-yaxis-'+yAxisNum+'-stacklabels-enabled') == '1' + enabled: getYaxisAttr($table, yAxisNum, 'stacklabels-enabled') == '1' }, - gridLineInterpolation: $table.data('graph-yaxis-'+yAxisNum+'-grid-line-interpolation') || null + gridLineInterpolation: getYaxisAttr($table, yAxisNum, 'grid-line-interpolation') || null }; var callableYAxisFormatter = getCallable(table, 'graph-yaxis-'+yAxisNum+'-formatter-callback'); + + if (!callableYAxisFormatter) { + callableYAxisFormatter = getCallable(table, 'graph-yaxis'+yAxisNum+'-formatter-callback'); + } + if (callableYAxisFormatter) { yAxisConfigCurrentAxis.labels.formatter = function () { return callableYAxisFormatter(this.value); diff --git a/tests/baseSpec.js b/tests/baseSpec.js index dc50b39..235be60 100644 --- a/tests/baseSpec.js +++ b/tests/baseSpec.js @@ -29,8 +29,10 @@ describe("Base test", function() { ' ' + ' '; - $('#fixture').remove(); - $('body').append(htmlContent); + $('body') + .empty() + .append(htmlContent) + ; }); @@ -48,7 +50,21 @@ describe("Base test", function() { expect(highChartConfig.series[0].data[1].name).toBe('12000'); expect(highChartConfig.series[0].data[1].y).toBe(12000); expect(highChartConfig.series[0].data[2].name).toBe('18000'); - expect(highChartConfig.series[0].data[2].y).toBe(18000); + expect(highChartConfig.series[0].data[2].y).toBe(18000) + expect(highChartConfig.yAxis[0].reversed).toBe(false); + + expect(highChartConfig.yAxis[0].reversed).toBe(false); + expect(highChartConfig.yAxis[0].stackLabels.enabled).toBe(false); + expect(highChartConfig.yAxis[0].min).toBeNull(); + expect(highChartConfig.yAxis[0].max).toBeNull(); + expect(highChartConfig.yAxis[0].title.text).toBeNull(); + expect(highChartConfig.yAxis[0].opposite).toBe(false); + expect(highChartConfig.yAxis[0].tickInterval).toBe(null); + expect(highChartConfig.yAxis[0].labels.rotation).toBe(0); + expect(highChartConfig.yAxis[0].gridLineInterpolation).toBeNull(); + expect(highChartConfig.yAxis[0].startOnTick).toBe(true); + expect(highChartConfig.yAxis[0].endOnTick).toBe(true); + expect(highChartConfig.yAxis[0].labels.formatter).toBeUndefined(); }) .highchartTable() ; diff --git a/tests/yaxisAttributesSpec.js b/tests/yaxisAttributesSpec.js new file mode 100644 index 0000000..98e3035 --- /dev/null +++ b/tests/yaxisAttributesSpec.js @@ -0,0 +1,155 @@ + +describe("Test yaxis ttributes", function() { + + var fixture; + + it("With numeric", function() { + + if ($.fn.jquery.substr(0, 1) == 2) { + return; + } + + graph_absInvertedFormatter = function (value) { + return Math.abs(value) * -1; + }; + + var htmlContent = ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
Example of title
MonthSales
January8000
February12000
March18000
'; + + $('body') + .empty() + .append(htmlContent) + ; + + var beforeRenderCalled = false; + + $('table') + .bind('highchartTable.beforeRender', function(event, highChartConfig) { + beforeRenderCalled = true; + expect(highChartConfig.yAxis[0].reversed).toBe(true); + expect(highChartConfig.yAxis[0].stackLabels.enabled).toBe(true); + expect(highChartConfig.yAxis[0].min).toBe(1000); + expect(highChartConfig.yAxis[0].max).toBe(25000); + expect(highChartConfig.yAxis[0].title.text).toBe("title example"); + expect(highChartConfig.yAxis[0].opposite).toBe(true); + expect(highChartConfig.yAxis[0].tickInterval).toBe(1000); + expect(highChartConfig.yAxis[0].labels.rotation).toBe(90); + expect(highChartConfig.yAxis[0].gridLineInterpolation).toBe("circle"); + expect(highChartConfig.yAxis[0].startOnTick).toBe(false); + expect(highChartConfig.yAxis[0].endOnTick).toBe(false); + expect(highChartConfig.yAxis[0].labels.formatter).toBeDefined(); + + }) + .highchartTable() + ; + + expect(beforeRenderCalled).toBe(true); + }); + + + it("Without numeric", function() { + + graph_absInvertedFormatter = function (value) { + return Math.abs(value) * -1; + }; + + var htmlContent = ' ' + + '' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
Example of title
MonthSales
January8000
February12000
March18000
'; + + $('body') + .empty() + .append(htmlContent) + ; + + + + var beforeRenderCalled = false; + + $('table') + .bind('highchartTable.beforeRender', function(event, highChartConfig) { + beforeRenderCalled = true; + expect(highChartConfig.yAxis[0].reversed).toBe(true); + expect(highChartConfig.yAxis[0].stackLabels.enabled).toBe(true); + expect(highChartConfig.yAxis[0].min).toBe(1000); + expect(highChartConfig.yAxis[0].max).toBe(25000); + expect(highChartConfig.yAxis[0].title.text).toBe("title example"); + expect(highChartConfig.yAxis[0].opposite).toBe(true); + expect(highChartConfig.yAxis[0].tickInterval).toBe(1000); + expect(highChartConfig.yAxis[0].labels.rotation).toBe(90); + expect(highChartConfig.yAxis[0].gridLineInterpolation).toBe("circle"); + expect(highChartConfig.yAxis[0].startOnTick).toBe(false); + expect(highChartConfig.yAxis[0].endOnTick).toBe(false); + expect(highChartConfig.yAxis[0].labels.formatter).toBeDefined(); + }) + .highchartTable() + ; + + expect(beforeRenderCalled).toBe(true); + }); +}); + + From 1f794d9c516d6e184a3b0511440b80836fb447be Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sun, 15 Nov 2015 10:47:40 +0100 Subject: [PATCH 15/17] add saucelabs credentials to travis.yml file --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 765671d..07f3a38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,9 @@ language: node_js node_js: - '0.11' env: - - JQUERY_VERSION=1.11.3 HIGHCHARTS_VERSION=2.2.4 - - JQUERY_VERSION=1.11.1 HIGHCHARTS_VERSION=2.2.4 + global: + - secure: G+VyUjYXpYO3djiUL62Vj/0PuQmWpHyyXZtKXW+Df77C45Uc+/G0DQL/YGn4tqc4DeAX5W5myTmfAm2q+B1fkg687HFH5HBHp3/RhY++KcitnLZ+8DlvBCIMuvUjgYdq1+pWr+kXg0OCybyyecqdXgRZ3FNTpatf6PIXC5a8PFA= + - secure: boiNPr9oRstsVXgXKqs/XfgWPJDNQYCkGjJ8tnZmGF2SVTCK5fOmwycbDpRk1oAzjwHc6pXoiLvqgRySFBoebpz8rIWEbjmxp06+9sN9bw51Za0RPCM2g+4XEg2yU/bzmEj3ZyI/ZEEpm5AOcxhGSyjyQjWiK8sefUB6WV8YkcI= + matrix: + - JQUERY_VERSION=1.11.3 HIGHCHARTS_VERSION=2.2.4 + - JQUERY_VERSION=1.11.1 HIGHCHARTS_VERSION=2.2.4 From 36f1f78521ec783ba1bf66fc036460bbd220ffe5 Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Sun, 15 Nov 2015 15:31:40 +0100 Subject: [PATCH 16/17] fix sauelabs credentials --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c908164..9b7de80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ node_js: - '0.11' env: global: - - secure: G+VyUjYXpYO3djiUL62Vj/0PuQmWpHyyXZtKXW+Df77C45Uc+/G0DQL/YGn4tqc4DeAX5W5myTmfAm2q+B1fkg687HFH5HBHp3/RhY++KcitnLZ+8DlvBCIMuvUjgYdq1+pWr+kXg0OCybyyecqdXgRZ3FNTpatf6PIXC5a8PFA= - - secure: boiNPr9oRstsVXgXKqs/XfgWPJDNQYCkGjJ8tnZmGF2SVTCK5fOmwycbDpRk1oAzjwHc6pXoiLvqgRySFBoebpz8rIWEbjmxp06+9sN9bw51Za0RPCM2g+4XEg2yU/bzmEj3ZyI/ZEEpm5AOcxhGSyjyQjWiK8sefUB6WV8YkcI= + - secure: CvvR0KZBaTnVfo3ylWPc/qssKzkay5rejVoHWjR7DrIHaesj3O17puOAr+jYJJ220Q4mn2RwpdTIyYAjjSxblq5g+F/MJMwslRh7mEYfdn39LnF30JYp6BkMrcygsJS8xAQ18i17lVMqqeMyJ/+Hu7GvWu1r6ZaWkr2HZ/P26v4= + - secure: gT/SPMZhtp3dNjS9VIKez/+sKzihE/5ffNtKczhTi71CQkvptgd9xdcLigidIgwaWptd3t8HwNFaUutx78xTIb40oP0mZNo95LiwoI6W7vzLyJjst2BVKz+hqj4Jg1P8FHkD5/fop4E/pL4lXmMB1p1Zd5QEebX6hcXgFz/ha7U= matrix: - JQUERY_VERSION=1.11.3 HIGHCHARTS_VERSION=2.2.4 - JQUERY_VERSION=2.1.4 HIGHCHARTS_VERSION=2.2.4 From 9fb40060ea76eee67f4bfffdc963ccdc40232136 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Fri, 16 Sep 2016 01:08:19 +0800 Subject: [PATCH 17/17] rich the information of package.json --- package.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/package.json b/package.json index c6fa33e..f606897 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,22 @@ { "name": "highchartTable", "version": "1.1.0", + "description": "This jQuery plugin provides a simple way to convert HTML data tables to Highcharts graphs.", + "author": "highchartTable Development Team (https://github.com/highchartTable/jquery-highchartTable-plugin/graphs/contributors)", + "repository": { + "type": "git", + "url": "git@github.com:highchartTable/jquery-highchartTable-plugin.git" + }, + "keywords": [ + "highcharts", + "chart", + "table", + "ui", + "graphics", + "graphs" + ], + "homepage": "http://highcharttable.org", + "license": "MIT", "scripts": { "test": "./node_modules/karma/bin/karma start karma.conf-ci.js" },