Move legend and title in the plugins folder (#4076)

This commit is contained in:
Simon Brunel 2017-03-25 18:28:54 +01:00 committed by GitHub
parent e3f3b8978b
commit f3816b560c
5 changed files with 10 additions and 10 deletions

View 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);

View 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);
}
}
});
};
};

View 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;
}
}
});
};
};