update chart logic