I have the following chart with plugin function:
this.doughnutChart = new Chart(this.doughnutCanvas.nativeElement, {
type: 'doughnut',
plugins: {
beforeDraw: function (chart) {
//I want to use data here
}
});
Data from a provider:
constructor(public dataService: Data)
And data is easily accessible from the class where chart and plugin is located, but I dont know how to inject it inside of plugin function.
我已经找到了答案,一切都在'chart'参数的最深处:
chart.config.config.data.someData;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.