Skip to Content
Interactive Data Visualization for the Web, 2nd Edition
book

Interactive Data Visualization for the Web, 2nd Edition

by Scott Murray
August 2017
Beginner to intermediate
472 pages
10h 17m
English
O'Reilly Media, Inc.
Content preview from Interactive Data Visualization for the Web, 2nd Edition

Appendix D. Sharing Your Code

The D3 community is big on sharing code, whether for showing off new projects and techniques or for asking for help. And let me tell you: people want to help you! But when asking questions, it’s essential to share your code. (Have you ever tried to debug a project without the project itself?)

You are free to publish and share your code however you like, but the most common venues are:

  • bl.ocks.org

  • Bl.ock Builder

  • Gistup

  • Codepen, JS Bin, or similar

  • Normal web server

I’ll walk through each of these options.

bl.ocks.org

Mike Bostock is a big fan of examples. He can’t get enough of them. In 2013, he even gave a great talk making the case for examples titled, yes, “For Example”.

In fact, to encourage us all to create and share our own examples, he built a web service called bl.ocks.org. The blocks service (as I will refer to it, because it is so annoying to type the period in “bl.ocks”) makes it very easy to share your D3 code and projects with others. You can use it to share any kind of code, not just JavaScript and D3, but because Mike built it, it’s sort of optimized for D3 purposes.

Thus, blocks are very popular in the D3 community. Posting a block and sharing the link is a great way to show off your latest project, share a work-in-progress with others, or—most importantly—to get help troubleshooting when you’re at your wit’s end. Before you even begin writing your question on StackOverflow or the D3 Google Group, post a block! Because the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Fundamentals of Data Visualization

Fundamentals of Data Visualization

Claus O. Wilke
Building Knowledge Graphs

Building Knowledge Graphs

Jesús Barrasa, Jim Webber

Publisher Resources

ISBN: 9781491921296Errata PageSupplemental Content