Sunday, May 8, 2016

building an interactive tree with d3.js php and sqlite: an annotated webliography

I want to make a tree with rectangular nodes containing text, such that I can add nodes or remove nodes on the fly. I want the tree to be "multiplayer": everybody who visits the site sees the same tree, and when one of them modifies it, it the updates are applied to everyone's view.
I know nothing about d3, and very little about PHP, but a bit about sqlite and Apache.
For this project I'm using a minimal number of libraries, and a very simple server setup, which leads to some inefficiencies. The server is Ubuntu 14.04 with Apache 2.4 with PHP 5.6. Client side the only library I'm using is d3.js 3.5.

A consequence of the simplicity is that I don't have a good way to push data to clients, so I can't use long polling or web sockets. Instead, I rely on repeated client requests for updates, which adds some latency, but hopefully not too much.


Requirements for graph:
Nodes are boxes that can contain about 50 words
terminal nodes can be added or removed (capability to add or remove internal nodes is not necessary)
root is on the left
subtrees can be expanded or collapsed
zoom-in zoom-out capability
pan capability
sort nodes with the older siblings above newer siblings


Let's get this figured out!