Separate all logic and data in trends graph