0
我試圖從URL訪問JSON數據以在D3中創建圖表。像無法從url訪問json d3.js
{
"Sheet1" : [{
"time" : 0,
"Date" : "2016-08-09T23:00:00.000Z",
"Impressions" : 18275,
"Cost" : 66.87,
"Actions:_link_clicks" : 110,
"Offsite_conversions" : 8,
"Actions:_video_views" : 2071,
"Reach" : 17692,
"Clicks" : 230,
"Call-to-action_clicks" : 0,
"Click-through_rate_(CTR)" : 1.26,
"Video_complete_views" : 549,
"Actions:_post_engagements" : 2210,
"Actions:_post_reactions" : 24,
"Actions:_posts" : 2
}, {
...
}
]
}
首先
var url = "https://script.google.com/macros/s/AKfycbwy56QiQwyfkkaLFWZ33QHVieAHhtLJYNa_AzKcCBr-J7Catgv2/exec?id=1vQsWQPUET20KcgeRKgs5NOOBngqLeUuNTHI1bWi5Et8&sheet=Sheet1";
d3.json(url, function (json) {
console.log(json[0]);
});
我的JSON數據loooks我只是想測試並在控制檯打印數據。但是沒有任何東西在控制檯上打印。
我做錯了什麼?
添加此在頭與腳本標記來引用d3.js:
"https://d3js.org/d3.v4.min.js"