require('./core/core.layoutService')(Chart);
require('./core/core.scaleService')(Chart);
require('./core/core.plugin.js')(Chart);
-require('./core/core.legend')(Chart);
require('./core/core.scale')(Chart);
require('./core/core.title')(Chart);
+require('./core/core.legend')(Chart);
require('./core/core.tooltip')(Chart);
require('./elements/element.arc')(Chart);
},
buildSurroundingItems: function() {
- if (this.options.title) {
+ /*if (this.options.title) {
this.titleBlock = new Chart.Title({
ctx: this.chart.ctx,
options: this.options.title,
});
Chart.layoutService.addBox(this, this.titleBlock);
- }
+ }*/
},
updateLayout: function() {
Chart.layoutService.addBox(chartInstance, chartInstance.legend);
}
}
- })
+ });
};
}
}
});
+
+ // Register the title plugin
+ Chart.pluginService.register({
+ beforeInit: function(chartInstance) {
+ var opts = chartInstance.options;
+ var titleOpts = opts.title;
+
+ if (titleOpts) {
+ chartInstance.titleBlock = new Chart.Title({
+ ctx: chartInstance.chart.ctx,
+ options: titleOpts,
+ chart: chartInstance
+ });
+
+ Chart.layoutService.addBox(chartInstance, chartInstance.titleBlock);
+ }
+ }
+ });
};
\ No newline at end of file