Create HTML stack diagrams with JavaScript