I am trying to recreate this d3 example in JSBIN
d3.csv("bar-data.csv", function(error, data) {
...
})
I am trying to reference the csv file but it does seem to be able to access the csv file:
d3.csv("http://bl.ocks.org/d3noob/raw/8952219/d45ad0a7caf9c499d1a1e975b3760c90f5321072/bar-data.csv", function(error, data) {
...
I have tried uploading the file to dropbox and using that link but that alos does not work.
Can anyone advise how I can get these urls to the csv file to work. or offer another way for me to try and recreate this example? The reason I want to recreate it is so I can modify and test it with other data and just generally do more with it....
NOTE Another option is to try jsfiddle, which I will, but I would like to use jsbin.
EDIT1
here is the JSFIDDLE using the dropbox link to the csv file. this is the error I get in firefox:
https://www.dropbox.com/s/plpl0yjxze9elpd/bar-data.csv 200 OK 966ms d3.v3.min.js (line 1)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.dropbox.com/s/plpl0yjxze9elpd/bar-data.csv. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
TypeError: data is undefined
EDIT2
One way is to not read in from the csv at all and have it in an array already , which takes a while to get it to the format I want, but I would still like to be able to get it to work by reading in the csv file.
data = [{"date":"2013-01","value":53},{"date":"2013-02","value":165},{"date":"2013-03","value":269},{"date":"2013-04","value":344},{"date":"2013-05","value":376},{"date":"2013-06","value":410},{"date":"2013-07","value":421},{"date":"2013-08","value":405},{"date":"2013-09","value":376},{"date":"2013-10","value":359},{"date":"2013-11","value":392},{"date":"2013-12","value":433},{"date":"2014-01","value":455},{"date":"2014-02","value":478}]
FIDDLE
JSBIN
It's going to be hard to find somewhere to drop that file that won't hit you with CORS restrictions. The easiest thing to do would just be to download the code and run it locally from a file.
If you really want to do it all in the browser, Plunker would be a good choice. It's similar to jsfiddle or jsbin, but allows you to create any type of file you want in your project. So just create a csv file there and paste the data in.
Related
We auto-publish a Google Docs Spreadsheet (one tab as CSV). Google docs is providing a fixed URL that refers to the CSV. We import this CSV in another tool for product data import.
Suddenly this URL is redirected by Google Spreadsheet. If we go again in "File/Publish To The Internet" we can the same URL for that CSV.
Question: How can get the URL without redirection again?
Error: Source file
https://docs.google.com/spreadsheets/d/e/2PACX-1vTQsBEmvOwFwxORMqYg2N6LzzYqdqsdDCjxqsdqsdH72gdMCP4xrs1lsN37RO4h1-rjJsQ/pub?gid=501162839&single=true&output=csv doesn't exist (HTTPS : File not found ! (HTTP/1.0 307 Temporary Redirect)). Please check the source file path.
In short, the collection process needs to follow the Location header. Depending how you're getting the CSV this might be simple or a pain. I collect CSVs using curl so just adding the -L switch is sufficient to make sure the incoming files are the CSV we're looking for instead of the HTML that we were getting without -L. Without knowing what utility or process you're using to download the CSV I can't be more specific, unfortunately.
I tried a few times via the web UI, but first the file wasn’t shown to me in the explorer and when i finally got around that and uploaded my .json there was one entry:
error: "Auth token is expired“
i just want to import that .json file, how does one do that?
The Auth Token probably expired because you were on the page too long before you uploaded it. Keep trying and it will work, given that the .json is correctly formatted.
I'm getting stuck on uploading a file via the data management API to a BIM 360 storage location, specifically the last step I've been following the step by step guide on the forge site here and saw an answer here however using postman copying and pasting it gets stuck on the final step "update the version of the file" every other step returns correctly however the last one gives me an error 400 BAD_INPUT response, not sure how to format the code and response so i just hosted it here
any help will be appreciated thank you!
I just tested with the BIM360 storage location, and it works good to me, there are a couple of issues you may need to keep in mind as follow:
Since you are using BIM360 hub, so when you try to create the first version of the uploaded file as you described, please use the correct extension type in the POST body, for BIM360, should be items:autodesk.bim360:File and versions:autodesk.bim360:File as follow:
When you try to create a storage under a folder using POST projects/:project_id/storage, in the POST body, you need to specify the folder, please make sure to use the correct folder that allow types of "items:autodesk.bim360:File", for example, the following folder is the root folder of my project, and it only allow the folder of "folders:autodesk.bim360:Folder", if you create a storage under this folder, you will get 403 forbid error.
But this folder should be Ok:
I was wondering if it's possible to open a local JSON file so I can just check its structure? Didn't/don't want to upload the file to an online JSON format checker site and was hoping I can just utilize PAW to do that.
Don't seem to be able to do this with a local file, unless I run it through a local server, eg using MAMP, unless I missed something...?
Thanks.
You could copy the content into the txt body then switch to the JSON body this will let you view it in the nice structure, sorry currently no way to directly import a file need to copy past the content.
Take a look at jsonlint npm module. Supports JSON schema validation and pretty printing.
I am working on the d3.js project in which I need to load json, tsv and csv files. I want to upload all the files on jsfiddle. In jsfiddle you have sections for html, css and javascript. But I am not sure how to load external json, csv and tsv file so that my D3 map can read it. I tried using [How to add local json file in jsfiddle? but I am getting error as:
"jquery-1.11.0.js:9666 XMLHttpRequest cannot load https://www.dropbox.com/s/n4anyoro797w2kq/test.json?dl=0. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access. The response had HTTP status code 405."
Where I am getting wrong? Any other approach for this?