Encapsulate duration share plot into an angular.js directive