Skip to content

Commit

Permalink
Make Chart.controllers.* importable (chartjs#5871)
Browse files Browse the repository at this point in the history
`controllers.*.js` and `core.datasetController.js` are now importable (no more function export), that's why there is so many changes mainly due to one indentation level removed. Split code for `bar/horizontalBar` and `doughnut/pie` in separate files, added a global controllers import (`src/controllers/index.js`) and add tests to check that all dataset controllers are correctly registered under `chart.controllers.{type}`.
  • Loading branch information
simonbrunel committed Nov 29, 2018
1 parent 639a022 commit 455a7b7
Show file tree
Hide file tree
Showing 20 changed files with 1,576 additions and 1,554 deletions.
13 changes: 2 additions & 11 deletions src/chart.js
Expand Up @@ -10,6 +10,8 @@ require('./core/core.helpers')(Chart);

Chart.Animation = require('./core/core.animation');
Chart.animationService = require('./core/core.animations');
Chart.controllers = require('./controllers/index');
Chart.DatasetController = require('./core/core.datasetController');
Chart.defaults = require('./core/core.defaults');
Chart.Element = require('./core/core.element');
Chart.elements = require('./elements/index');
Expand All @@ -23,7 +25,6 @@ Chart.Ticks = require('./core/core.ticks');
Chart.Tooltip = require('./core/core.tooltip');

require('./core/core.controller')(Chart);
require('./core/core.datasetController')(Chart);

require('./scales/scale.linearbase')(Chart);
require('./scales/scale.category')(Chart);
Expand All @@ -32,16 +33,6 @@ require('./scales/scale.logarithmic')(Chart);
require('./scales/scale.radialLinear')(Chart);
require('./scales/scale.time')(Chart);

// Controllers must be loaded after elements
// See Chart.core.datasetController.dataElementType
require('./controllers/controller.bar')(Chart);
require('./controllers/controller.bubble')(Chart);
require('./controllers/controller.doughnut')(Chart);
require('./controllers/controller.line')(Chart);
require('./controllers/controller.polarArea')(Chart);
require('./controllers/controller.radar')(Chart);
require('./controllers/controller.scatter')(Chart);

// Loading built-in plugins
var plugins = require('./plugins');
for (var k in plugins) {
Expand Down

0 comments on commit 455a7b7

Please sign in to comment.