JavaScript Mindmap

JavaScript Mindmap

Requires jQuery for basic shortcuts ($) and stuff.Requires Raphael for drawing.jQuery UI may be used to allow draggable nodes.The basic principles of a force directed layout controlling nodes are as free as the birds in the trees.It’s relatively easy to build a mindmap. Take a collection of HTML nodes, and position them absolutely. Use a Force Directed Layout to link them together and yet keep them apart.
Once you’ve got that, you need to add some filters, to define which nodes are properly connected. All nodes should repel, to prevent overlap, but connected nodes should have a string between them. This is where you use a springy force (hooke’s law) to pull them together.

Drawing lines in HTML is not an easy feat. IE has/had VML, all browsers (except Android) support SVG (albeit slowly), and all except IE support Canvas. I tried using a diagonal line in a JPG, stretching it to fit. It looks daft. I then switched to Canvas, and now I’m on SVG (using Raphael to support IE VML too). So it works everywhere except Android.

Leave a Reply