3d-force-graph icon indicating copy to clipboard operation
3d-force-graph copied to clipboard

Importing datasets locally

Open bperak opened this issue 5 years ago • 6 comments

I have an issue when trying to recreate the example files with .json datasets locally. I have downloaded the json files locally and stored it in the same folder. But when I change parameters in the scripts with, for instance, miserables.json .jsonUrl('miserables.json') ...I get only the data loading screen... Loading.... What I am doing wrong? Thank you for your time and answer. This is an amazing project :)

bperak avatar Nov 23 '19 16:11 bperak

@bperak thanks for reaching out. Do you see a (console) network error saying that the json file cannot be found? That can happen if you're not loading your files using a webserver, but opening the html directly in the browser. Could that be the reason?

vasturiano avatar Nov 25 '19 18:11 vasturiano

how do you see that i have the same error i can get the basic example to work but the large graph when i put in the full path to my data file just shows a loading page. thanks for your help the library looks wonderful

anorak94 avatar Nov 28 '19 12:11 anorak94

never mind i got it to work the problem was that local files couldnt be accessed so i disable the cors flag or enable it i dont know i download the chrome web server and run it from there works great nice package

anorak94 avatar Nov 28 '19 13:11 anorak94

but how do i expand the network more its too dense right now

anorak94 avatar Nov 28 '19 13:11 anorak94

@bperak thanks for reaching out. Do you see a (console) network error saying that the json file cannot be found? That can happen if you're not loading your files using a webserver, but opening the html directly in the browser. Could that be the reason?

The same problem. The console says

3d-force-graph:5 Fetch API cannot load file:///Users/xxxx/Desktop/data.json. URL scheme must be "http" or "https" for CORS request.

Is that means local file is not supported?

CorbinZhou avatar May 17 '21 08:05 CorbinZhou

@CorbinZhou that is not specific to this module. That's related to the security policies in your browser of what resources can be loaded. It's telling you that you have to load those resources over http, which basically means you need to use a web server, instead of opening the html file directly in your browser.

vasturiano avatar May 17 '21 11:05 vasturiano