首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >与webpack“导入”ing d3和d3云

与webpack“导入”ing d3和d3云
EN

Stack Overflow用户
提问于 2016-04-01 12:01:49
回答 1查看 1.2K关注 0票数 5

因此,我一直试图将d3D3云(用于word云)导入到我的AngularJs(v-1.4)应用程序中。我这么做是为了-

从“d3”导入d3

从'd3-cloud‘导入d3Cloud。

当我尝试使用像d3.layout.cloud()这样的d3云时,我会得到以下错误

_d2.default.layout.cloud不是一个函数

EN

回答 1

Stack Overflow用户

发布于 2018-06-21 18:44:33

代码语言:javascript
运行
复制
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();

}
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36355842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档