使用Chart JS 2.0扩展现有图表类型角度图js [英] Extending Existing Chart Types angular chart js using chart js 2.0
问题描述
我正在使用出色的 chart.js
(版本:2.0 .2)和 angular-chart.js (版本:1.0.0-beta1 )出于兼容性目的。我想在项目中添加很多功能(例如向水平线添加水平线图表或具有圆角条形图)。所有这些解决方案都使用
I'm using the great chart.js (Version: 2.0.2) and angular-chart.js (Version: 1.0.0-beta1) for compatibility purposes. There are a lot of functionalities I would like to add to my project (like adding a horizontal line to a chart or having a rounded corners bar chart). All theses solutions use
Chart.types.[typeOftheChartToExtend].extend({..}).
我在chart.js v2.0中使用它, doc 不太清楚。如何使用chart.js v2.0 扩展现有图表?
I'm stuck using it with chart.js v2.0, the doc isn't very clear. How can I extend existing chart using chart.js v2.0 ?
任何建议或示例都将不胜感激。谢谢!
Any advice or example would be appreciated. Thanks!
推荐答案
答案有点晚,但是您可以从以下位置扩展元素的形状,而不是特定图表的类型v2。
A bit late answer but you can extend the shape of the element, not the type of the specific chart, from v2.
例如,
Chart.elements.Rectangle.prototype.draw = function() {
// Do your draw thingy.
}
有在Github官方仓库上与此问题有关的一个问题,并且还有一个很好的例子。
这篇关于使用Chart JS 2.0扩展现有图表类型角度图js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!