refactoring plotting to tdad3.js