简体   繁体   English

如何使用 Angular 7 和 Chartjs (v2) 创建圆形条形图

[英]How to create rounded bar graph with Angular 7 and Chartjs (v2)

I am trying to change the bar chart of the chartJs library (version 2.8.0) in angular 7. I have seen other answers about overriding the rectangular element's draw method.我正在尝试更改 angular 7 中 chartJs 库(版本 2.8.0)的条形图。我已经看到了有关覆盖矩形元素绘制方法的其他答案。 However, using such an approach presents the following error:但是,使用这种方法会出现以下错误:

Property 'elements' does not exist on type 'typeof Chart' “typeof Chart”类型上不存在属性“elements”

I am importing as follows:我导入如下:

import {Chart, ChartType, ChartOptions, ChartDataSets} from 'chart.js';从'chart.js'导入{Chart,ChartType,ChartOptions,ChartDataSets};

I am trying to use the solution presented in the following topic: How to create rounded bars for Bar Chart.js v2?我正在尝试使用以下主题中介绍的解决方案: How to create rounded bars for Bar Chart.js v2?

Print of the code: Error code代码打印:错误代码

The error is due to a typing problem in chartjs with typescript.该错误是由于使用 typescript 的 chartjs 中的输入问题造成的。 The @ts-ignore annotation was added and everything worked.添加了@ts-ignore注释,一切正常。

Thank god.感谢上帝。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM