connecting charts to db