如何使用 TypeScript 和来自 github 的 Chartjs.definelyTyped 计算出 Chartjs

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29885809/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:59:44  来源:igfitidea点击:

How to work out Chartjs using TypeScript with Chartjs.definitelyTyped from github

javascriptangularjstypescriptchart.js

提问by amcpanaligan

I want to use Chartjs(chartjs.org) as my charting tool along with AngularJS using TypeScript. I have installed DefinitelyTyped for Chartjs from GitHub to incorporate creation of Chartjs charts in my TypeScript written controller. I can't find any related questions on doing this thing.

我想使用 Chartjs(chartjs.org) 作为我的图表工具以及使用 TypeScript 的 AngularJS。我已经从 GitHub 为 Chartjs 安装了绝对类型化,以在我的 TypeScript 编写的控制器中合并 Chartjs 图表的创建。我找不到任何关于做这件事的相关问题。

I just need to know how we populate data to our charts using DefinitelyTyped.

我只需要知道我们如何使用绝对类型将数据填充到我们的图表中。

回答by basarat

You can find example usages of chart.d.tsin the form of a tests file right next to the definition : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/chart.js/chart.js-tests.ts

您可以chart.d.ts在定义旁边以测试文件的形式找到示例用法:https: //github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/chart.js/chart.js-tests.ts