2 KiB
2 KiB
d3 draggable object example #1 – standalone
#
#
#
#
Introduction
Creating a draggable object in d3. Followed guide originally here (sadly now-broken link): http://ssun.azurewebsites.net/creating-a-draggable-object-in-d3
.orgsource for this file is here: file:index-src.org
Try it here
Prerequisites
- A directory tree
$HTTP_ROOTthat you can visit in a browser or serve via http. I'm using$HOME/proj/public_html/org-howto, for example -
Mike Bostock's
d3installed in$HTTP_ROOT/ext/d3:ls -l $HOME/proj/public_html/org-howto/ext/d3total 336 -rw-rw-r-- 1 roland roland 151725 Mar 12 00:06 d3.v3.min.js
-
Optionally, a webserver making
$HTTP_ROOTavailable over http, for example:cd $HOME/Dropbox/public_html python -m SimpleHTTPServer 8080
When this is in place,
we should be able to bring up d3.js in a browser here: http:/ext/d3/d3.js
Procedure
Create skeleton html file
This is the file browser will load to deliver our example.
Create drag-example.html.
Create javascript file drag-example.js
Create drag-example.js.
This is where our d3 code lives.