Bond diagram drawer in JavaScript