发布于 2018-06-21 18:44:33
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();
}https://stackoverflow.com/questions/36355842
复制相似问题