Refactored trendline chart into a directive