0
我有一个基于d3的自定义甘特图书馆。它是用普通的javascript编写的。现在我想将它添加到我的Angular 2应用程序中。我通过媒体链接安装NPM D3并增加了一个类型的文件,以及甘特图到node_modules但我得到了以下错误消息:Angular 2定义文件
__WEBPACK_IMPORTED_MODULE_4_d3__.gantt is not a function
我想这是因为出口和定义文件错误使用。但我不知道如何解决它。
node_modules/D3/index.js:
export {version} from "./build/package";
export * from "d3-array";
.
.
.
export * from "d3-gantt";
node_modules/D3的甘特/ index.js:
export default gantt;
function gantt()
{
// a lot of code
return gantt
}
node_modules/@types/d3/index.d.ts:
export as namespace d3;
export * from 'd3-array';
.
.
.
export * from 'd3-gantt';
node_modules/@types/d3-gantt/index.d.ts:
export function gantt(): any;
的src /应用/ AppComponent.ts
buildGantt(){
...
import * as d3 from 'd3'
d3.gantt().taskTypes(taskNames).taskStatus(taskStatus).selector('#d3Chart') //here i get the error
...
}
我也有类似的问题,你解决了吗? – David
@David我记得我的解决方案,因为我记得 – Florian