resolve d3 js error. optimize how charts are drawn. closes #161
store current chapter/id in global vars; refer to those vars