def create_dates_list(state_dates, dates_string, key, start_capital):

    """
    Create a dict used to update x_axis values and string.

    :param state_dates: boolean, show or not dates on axis
    :param dates_string: list of dates plotted
    :param key: string, type of graph
    :param start_capital: float
    """

    # keys are idx of trade and values are date string
    if state_dates == 2:
        xaxis_dict = dict(enumerate(dates_string))

    # keys and values are idx of trades
    else:
        xaxis_dict = {i: i for i in range(len(dates_string))}

    if key == "Growth" and start_capital == 0.0:
        xaxis_dict = {}  # don"t set string if no data

    return xaxis_dict