【发布时间】:2018-06-15 18:13:14
【问题描述】:
我是 javascript 和 D3 的初学者。我想使用 D3 创建一个气泡图,我需要从外部文件中获取数据。我已经搜索了其他方法,但看起来没有任何效果。有谁知道我该怎么做?
function animatedBubbleChart() {
var bubbleChart = new d3.svg.BubbleChart({
supportResponsive: true,
size: 800,
innerRadius: 600 / 3.5,
radiusMin: 50,
data: {
items: [//replace this with data from a json
{text: "2010", count: "170"},
{text: "2011", count: "170"},
{text: "2012", count: "170"},
{text: "2013", count: "170"},
{text: "2014", count: "170"},
{text: "2015", count: "170"},
{text: "2016", count: "170"},
],
eval: function (item) {return item.count;},
classed: function (item) {return item.text.split(" ").join("");}
},
plugins: [
{
【问题讨论】:
-
嗯,这看起来不像是纯D3代码,这里有某种插件。因此,请编辑您的问题,向我们展示您使用的插件是什么,以便您获得适当的帮助。另外,我删除了 sn-p,它仅用于运行代码。
-
什么不起作用?加载数据是唯一的问题吗?请更新您的问题以详细说明。
标签: javascript json d3.js