add chart logic