How to run Mike Bostock's D3 examples?

前端 未结 2 1581
独厮守ぢ
独厮守ぢ 2021-02-10 03:01

I\'ve been trying to run Mike Bostock\'s See-Through Globe example, but the references to his json files are incorrect if you try to reproduce it locally.

The issue comes

2条回答
  •  悲&欢浪女
    2021-02-10 03:53

    You can't access the remote json files because of same origin policy. And you won't be able to retrieve a JSON object using the file: protocol. Unless you want to perform surgery on the code by embedding the JSON directly, you're going to have to run a local server.

    An easy way to run a local web server is execute:

    python -m SimpleHTTPServer 8888 &
    

    from the "root" directory of your site and then access it via http://localhost:8888

提交回复
热议问题