d3.js从以下网址获得JSON [英] d3.js get JSON from url

查看:166
本文介绍了d3.js从以下网址获得JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的情况是,我试图让D3读取存储在Windows Azure的Blob存储一个JSON文件。如果我的网址粘贴到浏览器然后将文件下载到我的机器。我希望能够得到与D3的URL JSON文件,但没有图形产生这使我相信,D3是无法读取该文件。

The situation is that i am trying to get d3 to read a JSON file which is stored in Windows Azure Blob storage. If i paste the url into a browser then the file is downloaded to my machine. I would like to be able get the JSON file from the url with d3, but no graph is produced which leads me to believe that the d3 is unable to read the file.

下面是code的一个片段:

Here is a snippet of the code:

            var url = "http://storageName.blob.core.windows.net/containerName/file.json";

            d3.json("url", function (json) {

             //code here
            })

我已经设置了容器在Azure上公开的,所以我认为它应该是与URL的任何人访问。有什么建议?

I have set the container to public on Azure, so i believe that it should be accessible to anyone with the url. Any suggestions?

推荐答案

你必须设置Content-Type HTTP头对你的blob应用/ JSON。

you'll have to set the Content-Type http header to "application/json" on your blob.

可以编程方式或使用REST API,或者使用免费的实用工具一样莓探险的蔚蓝Blob存储。

It can be done programmatically or using the rest API, or using a free utility like cloudberry explorer for azure blob storage.

这篇关于d3.js从以下网址获得JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆