Add chart logic