Still having trouble embedding.

TODO copy the mpld3 implementation as closely as possible