put chart coords in separate function