def set_max_x(res, flg, max_x):
    """Tests/sets max length of x-axis values."""
    test = res[-1][1 if flg == "x" else 0]

    if (len(str(test)) if type(test) is str else test) > max_x:
        max_x = len(str(test)) if type(test) is str else test

    return max_x