https://c3js.org
This is a wrapper for D3 that is higher level. Assuming we can get all the functionality, this would simplify our code.
d3chart also needs to be broken into frontend and backend scripts. I wrote it as one monolithic script to mimic the old cgi-bin/chart, and to make it a drop-in replacement, but that limits the flexibility of it and makes the code hard to read.