How to run Mike Bostock's D3 examples?

前端 未结 2 427
耶瑟儿~
耶瑟儿~ 2021-02-10 03:19

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 04:01

    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

提交回复
热议问题