]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Move legend and title in the plugins folder (#4076)
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 25 Mar 2017 17:28:54 +0000 (18:28 +0100)
committerGitHub <noreply@github.com>
Sat, 25 Mar 2017 17:28:54 +0000 (18:28 +0100)
src/chart.js
src/plugins/plugin.legend.js [moved from src/core/core.legend.js with 99% similarity]
src/plugins/plugin.title.js [moved from src/core/core.title.js with 98% similarity]
test/specs/plugin.legend.tests.js [moved from test/specs/core.legend.tests.js with 100% similarity]
test/specs/plugin.title.tests.js [moved from test/specs/core.title.tests.js with 100% similarity]

index 591572110e89bedd1187adbfe574908ff0e69c0c..4771b6d65626e3c4499f1500f3a2293bcca6af1e 100644 (file)
@@ -15,8 +15,6 @@ require('./core/core.layoutService')(Chart);
 require('./core/core.scaleService')(Chart);
 require('./core/core.ticks.js')(Chart);
 require('./core/core.scale')(Chart);
-require('./core/core.title')(Chart);
-require('./core/core.legend')(Chart);
 require('./core/core.interaction')(Chart);
 require('./core/core.tooltip')(Chart);
 
@@ -52,7 +50,11 @@ require('./charts/Chart.Scatter')(Chart);
 // Loading built-it plugins
 var plugins = [];
 
-plugins.push(require('./plugins/plugin.filler.js')(Chart));
+plugins.push(
+    require('./plugins/plugin.filler.js')(Chart),
+    require('./plugins/plugin.legend.js')(Chart),
+    require('./plugins/plugin.title.js')(Chart)
+);
 
 Chart.plugins.register(plugins);
 
similarity index 99%
rename from src/core/core.legend.js
rename to src/plugins/plugin.legend.js
index b68f1de1a9c6843c750089e30dc49a4aed1c8fc0..a2d21d0b625d4793669e56a45211ef2e0a8846bf 100644 (file)
@@ -507,8 +507,7 @@ module.exports = function(Chart) {
                Chart.layoutService.addBox(chart, legend);
        }
 
-       // Register the legend plugin
-       Chart.plugins.register({
+       return {
                id: 'legend',
 
                beforeInit: function(chart) {
@@ -541,5 +540,5 @@ module.exports = function(Chart) {
                                legend.handleEvent(e);
                        }
                }
-       });
+       };
 };
similarity index 98%
rename from src/core/core.title.js
rename to src/plugins/plugin.title.js
index eb060082433e1372d01825c43885b4bf79dc662c..34490c16f909624c75174763675fdf70db7e0f7e 100644 (file)
@@ -3,6 +3,7 @@
 module.exports = function(Chart) {
 
        var helpers = Chart.helpers;
+       var noop = helpers.noop;
 
        Chart.defaults.global.title = {
                display: false,
@@ -16,7 +17,6 @@ module.exports = function(Chart) {
                text: ''
        };
 
-       var noop = helpers.noop;
        Chart.Title = Chart.Element.extend({
                initialize: function(config) {
                        var me = this;
@@ -195,8 +195,7 @@ module.exports = function(Chart) {
                Chart.layoutService.addBox(chart, title);
        }
 
-       // Register the title plugin
-       Chart.plugins.register({
+       return {
                id: 'title',
 
                beforeInit: function(chart) {
@@ -223,5 +222,5 @@ module.exports = function(Chart) {
                                delete chart.titleBlock;
                        }
                }
-       });
+       };
 };