Moved width calculation into render method for d3 directives so it is recalculated if browser is resized