mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Move legend and title in the plugins folder (#4076)
This commit is contained in:
parent
e3f3b8978b
commit
f3816b560c
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user