2016-06-10 22:26:35 +02:00
|
|
|
/**
|
|
|
|
* @namespace Chart
|
|
|
|
*/
|
2017-07-01 09:59:26 +02:00
|
|
|
var Chart = require('./core/core')();
|
2016-02-14 02:12:26 +01:00
|
|
|
|
2017-07-15 15:13:56 +02:00
|
|
|
Chart.helpers = require('./helpers/index');
|
|
|
|
|
|
|
|
// @todo dispatch these helpers into appropriated helpers/helpers.* file and write unit tests!
|
2016-02-14 02:12:26 +01:00
|
|
|
require('./core/core.helpers')(Chart);
|
2017-05-05 06:34:23 +02:00
|
|
|
|
2018-04-02 10:55:52 +02:00
|
|
|
Chart.Animation = require('./core/core.animation');
|
|
|
|
Chart.animationService = require('./core/core.animations');
|
2017-07-16 19:38:19 +02:00
|
|
|
Chart.defaults = require('./core/core.defaults');
|
2017-07-21 08:40:01 +02:00
|
|
|
Chart.Element = require('./core/core.element');
|
|
|
|
Chart.elements = require('./elements/index');
|
2017-07-16 19:38:19 +02:00
|
|
|
Chart.Interaction = require('./core/core.interaction');
|
2018-01-09 14:12:40 +01:00
|
|
|
Chart.layouts = require('./core/core.layouts');
|
2017-07-16 11:02:25 +02:00
|
|
|
Chart.platform = require('./platforms/platform');
|
2018-01-08 11:48:59 +01:00
|
|
|
Chart.plugins = require('./core/core.plugins');
|
2018-04-02 23:43:28 +02:00
|
|
|
Chart.Scale = require('./core/core.scale');
|
|
|
|
Chart.scaleService = require('./core/core.scaleService');
|
2018-01-06 18:59:47 +01:00
|
|
|
Chart.Ticks = require('./core/core.ticks');
|
2018-04-02 10:55:52 +02:00
|
|
|
Chart.Tooltip = require('./core/core.tooltip');
|
2017-07-16 11:02:25 +02:00
|
|
|
|
2016-02-14 02:12:26 +01:00
|
|
|
require('./core/core.controller')(Chart);
|
|
|
|
require('./core/core.datasetController')(Chart);
|
|
|
|
|
2017-07-01 09:59:26 +02:00
|
|
|
require('./scales/scale.linearbase')(Chart);
|
2016-02-14 02:12:26 +01:00
|
|
|
require('./scales/scale.category')(Chart);
|
|
|
|
require('./scales/scale.linear')(Chart);
|
|
|
|
require('./scales/scale.logarithmic')(Chart);
|
|
|
|
require('./scales/scale.radialLinear')(Chart);
|
|
|
|
require('./scales/scale.time')(Chart);
|
|
|
|
|
2016-05-20 23:42:24 +02:00
|
|
|
// 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);
|
2017-07-16 19:38:19 +02:00
|
|
|
require('./controllers/controller.scatter')(Chart);
|
2016-02-14 02:12:26 +01:00
|
|
|
|
2018-04-02 23:43:28 +02:00
|
|
|
// Loading built-in plugins
|
2018-01-08 11:48:59 +01:00
|
|
|
var plugins = require('./plugins');
|
|
|
|
for (var k in plugins) {
|
|
|
|
if (plugins.hasOwnProperty(k)) {
|
|
|
|
Chart.plugins.register(plugins[k]);
|
|
|
|
}
|
|
|
|
}
|
2017-03-18 11:08:57 +01:00
|
|
|
|
2017-08-01 14:28:45 +02:00
|
|
|
Chart.platform.initialize();
|
|
|
|
|
2017-03-21 01:37:34 +01:00
|
|
|
module.exports = Chart;
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
window.Chart = Chart;
|
|
|
|
}
|
2017-07-15 15:13:56 +02:00
|
|
|
|
|
|
|
// DEPRECATIONS
|
|
|
|
|
2018-01-08 11:48:59 +01:00
|
|
|
/**
|
|
|
|
* Provided for backward compatibility, not available anymore
|
|
|
|
* @namespace Chart.Legend
|
|
|
|
* @deprecated since version 2.1.5
|
|
|
|
* @todo remove at version 3
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Chart.Legend = plugins.legend._element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provided for backward compatibility, not available anymore
|
|
|
|
* @namespace Chart.Title
|
|
|
|
* @deprecated since version 2.1.5
|
|
|
|
* @todo remove at version 3
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Chart.Title = plugins.title._element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provided for backward compatibility, use Chart.plugins instead
|
|
|
|
* @namespace Chart.pluginService
|
|
|
|
* @deprecated since version 2.1.5
|
|
|
|
* @todo remove at version 3
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Chart.pluginService = Chart.plugins;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provided for backward compatibility, inheriting from Chart.PlugingBase has no
|
|
|
|
* effect, instead simply create/register plugins via plain JavaScript objects.
|
|
|
|
* @interface Chart.PluginBase
|
|
|
|
* @deprecated since version 2.5.0
|
|
|
|
* @todo remove at version 3
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Chart.PluginBase = Chart.Element.extend({});
|
|
|
|
|
2017-07-15 15:13:56 +02:00
|
|
|
/**
|
|
|
|
* Provided for backward compatibility, use Chart.helpers.canvas instead.
|
|
|
|
* @namespace Chart.canvasHelpers
|
|
|
|
* @deprecated since version 2.6.0
|
|
|
|
* @todo remove at version 3
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Chart.canvasHelpers = Chart.helpers.canvas;
|
2018-01-07 23:38:26 +01:00
|
|
|
|
|
|
|
/**
|
2018-01-09 14:12:40 +01:00
|
|
|
* Provided for backward compatibility, use Chart.layouts instead.
|
2018-01-07 23:38:26 +01:00
|
|
|
* @namespace Chart.layoutService
|
2018-11-29 07:56:20 +01:00
|
|
|
* @deprecated since version 2.7.3
|
2018-01-07 23:38:26 +01:00
|
|
|
* @todo remove at version 3
|
|
|
|
* @private
|
|
|
|
*/
|
2018-01-09 14:12:40 +01:00
|
|
|
Chart.layoutService = Chart.layouts;
|
2018-11-29 07:56:20 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provided for backward compatibility, instead we should create a new Chart
|
|
|
|
* by setting the type in the config (`new Chart(id, {type: '{chart-type}'}`).
|
|
|
|
* @deprecated since version 2.8.0
|
|
|
|
* @todo remove at version 3
|
|
|
|
*/
|
|
|
|
Chart.helpers.each(
|
|
|
|
[
|
|
|
|
'Bar',
|
|
|
|
'Bubble',
|
|
|
|
'Doughnut',
|
|
|
|
'Line',
|
|
|
|
'PolarArea',
|
|
|
|
'Radar',
|
|
|
|
'Scatter'
|
|
|
|
],
|
|
|
|
function(klass) {
|
|
|
|
Chart[klass] = function(ctx, cfg) {
|
|
|
|
return new Chart(ctx, Chart.helpers.merge(cfg || {}, {
|
|
|
|
type: klass.charAt(0).toLowerCase() + klass.slice(1)
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|