Refactoring chartbuilder.js. Toward #73. #94.