Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

d3.js - Make Gist from Github repo for display on bl.ocks.org

I have created a data visualization app and posted it as a Github page. I would now like to display this on the bl.ocks.org site that aggregates D3.js visualizations. How can I start from the github repo and create a gist that maintains the relative dependencies of the repo code? Will I need to refactor all the code to make a single-file app that points to only CDN sources?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's easiest to learn by example. Take the example on the bl.ocks home page:

http://bl.ocks.org/mbostock/1353700

Now to see the gist that generated it, just take the id number from the end of the url and appent it the gist url, like so:

http://gist.github.com/1353700

That gist contains 3 files, but two are optional. The only requirement for a block to display is to have index.html. That file should contain your a full html file with your js script any includes to cdn resources like d3. Optionally, you could put your javascript code in a separate file and add that to the gist, and then link to it from your index.html file.

You can also add a README.md and thumbnail.png, if you'd like to provide a description of your example and an image for it. This is explained on the bl.ocks home page as well.

Hope that helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...