我正在使用伟大的
chart.js
(版本:2.0.2)和 angular-chart.js(版本:1.0.0-beta1)用于兼容性目的.我想在项目中添加很多功能(如 adding a horizontal line to a chart或 rounded corners bar chart).所有这些解决方案都使用
(版本:2.0.2)和 angular-chart.js(版本:1.0.0-beta1)用于兼容性目的.我想在项目中添加很多功能(如 adding a horizontal line to a chart或 rounded corners bar chart).所有这些解决方案都使用
Chart.types.[typeOftheChartToExtend].extend({..}).
我坚持使用chart.js v2.0,doc不是很清楚.如何使用chart.js v2.0扩展现有图表?
任何建议或例子将不胜感激.谢谢!
解决方法
有点迟到但你可以从v2扩展元素的形状,而不是特定图表的类型.
例如,
Chart.elements.Rectangle.prototype.draw = function() { // Do your draw thingy. }
有an issue regarding this one at the official Github repo和a great example of implementing it.