How to publish a chart to http://bl.ocks.org
You have seen awesome d3 data visualizations along with its code snippets in d3js.org gallery. Want to create and publish one like that?
If u have a beautiful visualisation created by d3js and want to publish it as a block in http://bl.ocks.org. ie You want to access your visualization via url like http://bl.ocks.org/xxxxx/06c2b5a357ad862a9157
Here is how to do this. You just need to create a gist (ie, just need a github account).
1. Go to https://gist.github.com.
2. Create an index.html file and paste the code for your visualization in index.html. After saving your file, check the url, along with your username an id will be generated for your gist as in the example below.(Visualization for a simple dashed line).
https://gist.github.com/nidheesh872/06c2b5a357ad862a9157
3. Now just change the url. Replace https://gist.github.com by http://bl.ocks.org/. done.
eg: http://bl.ocks.org/nidheesh872/06c2b5a357ad862a9157
bl.ocks.org is a tool which will convert the gist code into the format what you see in bl.ocks.org.
No comments:
Post a Comment