所以,我一直在尝试导入d3 https://d3js.org/ and d3-cloud https://github.com/jasondavies/d3-cloud(对于词云)
进入我的 AngularJs(v - 1.4) 应用程序。我这样做是通过-
从“d3”导入 d3
从“d3-cloud”导入 d3Cloud.
当我尝试使用 d3-cloud 时d3.layout.cloud()我收到以下错误
_d2.default.layout.cloud 不是一个函数
import { Component, Input, AfterViewInit } from '@angular/core';
// import and assign libs **
import d3 from 'd3'
import * as cloud from 'd3-cloud'
@Component({
selector: 'word-cloud',
templateUrl: './word-cloud.component.html',
styleUrls: ['./word-cloud.component.scss'],
providers: []
})
export class WordCloudComponent implements AfterViewInit {
constructor() { }
ngAfterViewInit() {
d3.scale.category20();
let layout = cloud()
.size([ width , height ])
.words(data)
.rotate(function () ...)
.spiral('rectangular')
.fontSize(function () ...)
.on("end", function () ...)
.start();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)