d3-cloud 仅呈现单词列表中的一个单词

d3-cloud renders only one word from list of words

我一直在尝试为 d3-cloud 创建一个简单的示例,但不知何故它没有按预期工作。我正在传递一个单词列表,但 d3-cloud 只呈现一个单词。我也检查了 svg 元素,其中只有一个文本元素。非常感谢任何帮助。

Please find the link for plunker

您应该添加 fontSize 方法。看看my fork of your plunker.

  let d3cloud = d3.layout.cloud()
                .size([width,height])
                .rotate(0)
                .fontSize(40) // <-- !!!
                .on("end", this.drawCloud)
                .words(entity_list);