def update_figure(n_clicks):
    gear_ratios = GetTransmissionRatios.GetTransmissionRatios.get_trans_ratios(
        final_dict)

    transfercase_final_value = GetTransmissionRatios.GetTransmissionRatios.get_tcase_ratios(
        final_dict)

    traces = []
    # transmissionGearRatio = gear_ratios[-1]

    for diff_gear_ratio in WranglerRatiosLookup.wrangler_diff_ratios():
        df = pd.DataFrame(
            Calculate.JeepGearSplitter.calculateSpeedFromRpm(
                diff_gear_ratio,
                tireDiameter=final_dict['tireDiameter'],
                transmissionGearRatio=gear_ratios[-1],
                transferCaseRatio=transfercase_final_value)).transpose()
        df.columns = ['RPM', 'MPH']

        trace = go.Scatter(x=df['RPM'], y=df['MPH'], name=diff_gear_ratio)
        traces.append(trace)

    layout = go.Layout(title='Differential Gear Ratio Comparisons',
                       xaxis={'title': 'RPM'},
                       yaxis={'title': 'MPH'})

    return {'data': traces, 'layout': layout}
    def get_trans_ratios(final_dict):
        gear_ratios = []
        # --- determine which transmission list to use ---
        # --- automatic transmisions ---
        if final_dict['jeep_model'] == 'jk_2012' and final_dict[
                'transmissionType'] == 'auto':
            gear_ratios = WranglerRatiosLookup.jk_2012_auto_trans_ratios()
        if final_dict['jeep_model'] == 'jk_2007' and final_dict[
                'transmissionType'] == 'auto':
            gear_ratios = WranglerRatiosLookup.jk_2007_auto_trans_ratios()
        if final_dict['jeep_model'] == 'jl' and final_dict[
                'transmissionType'] == 'auto':
            gear_ratios = WranglerRatiosLookup.jl_automatic_trans_ratios()

        # --- manual transmissions ---
        if final_dict['jeep_model'] == 'jk_2012' and final_dict[
                'transmissionType'] == 'manual':
            gear_ratios = WranglerRatiosLookup.jk_2012_manual_trans_ratios()
        if final_dict['jeep_model'] == 'jk_2007' and final_dict[
                'transmissionType'] == 'manual':
            gear_ratios = WranglerRatiosLookup.jk_2007_manual_trans_ratios()
        if final_dict['jeep_model'] == 'jl' and final_dict[
                'transmissionType'] == 'manual':
            gear_ratios = WranglerRatiosLookup.jl_manual_trans_ratios()
        return gear_ratios
def display_tire_size(some_number, some_value):
    # number = numbers_dict['mph'] * numbers_dict['rpm']
    # return number
    gear_ratios = []
    # --- determine which transmission list to use ---
    # --- automatic transmisions ---
    if numbers_dict['jeep_model'] == 'jk_2012' and numbers_dict[
            'transmissionType'] == 'auto':
        gear_ratios = WranglerRatiosLookup.jk_2012_auto_trans_ratios()
    if numbers_dict['jeep_model'] == 'jk_2007' and numbers_dict[
            'transmissionType'] == 'auto':
        gear_ratios = WranglerRatiosLookup.jk_2007_auto_trans_ratios()
    if numbers_dict['jeep_model'] == 'jl' and numbers_dict[
            'transmissionType'] == 'auto':
        gear_ratios = WranglerRatiosLookup.jl_automatic_trans_ratios()

    # --- manual transmissions ---
    if numbers_dict['jeep_model'] == 'jk_2012' and numbers_dict[
            'transmissionType'] == 'manual':
        gear_ratios = WranglerRatiosLookup.jk_2012_manual_trans_ratios()
    if numbers_dict['jeep_model'] == 'jk_2007' and numbers_dict[
            'transmissionType'] == 'manual':
        gear_ratios = WranglerRatiosLookup.jk_2007_manual_trans_ratios()
    if numbers_dict['jeep_model'] == 'jl' and numbers_dict[
            'transmissionType'] == 'manual':
        gear_ratios = WranglerRatiosLookup.jl_manual_trans_ratios()

    # --- Determine transfer case ratio ---
    if numbers_dict['fourLowEngaged'] is True and numbers_dict[
            'rubicon'] is True:
        transfercase_final_value = 4  # rubicon
    elif numbers_dict['fourLowEngaged'] is True and numbers_dict[
            'rubicon'] is False:
        transfercase_final_value = 2.76  # non-rubicon
    else:
        transfercase_final_value = 1  # not engaged, so 1:1

    return float("{0:.2f}".format(
        Calculate.JeepGearSplitter.calculateTireDiameter(
            mph=numbers_dict['mph'],
            rpm=numbers_dict['rpm'],
            tranny_gear=gear_ratios[-1],
            tcase=transfercase_final_value,
            diff=numbers_dict['differentialGearRatio'])))
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import WranglerRatiosLookup, Calculate

app = dash.Dash()

jeep_model_list = []
for key, value in WranglerRatiosLookup.jeep_model_dict().items():
    jeep_model_list.append({'label': key, 'value': value})

diff_list = []
for diff in WranglerRatiosLookup.wrangler_diff_ratios():
    diff_list.append({'label': str(diff) + ':1', 'value': diff})

app.layout = html.Div([
    dcc.Input(id='mph-in', value=70, debounce=True, type='float'),
    ' Enter MPH',
    html.Div(id='mph-out'),
    dcc.Input(id='rpm-in', value=2666, debounce=True, type='float'),
    ' Enter RPM',
    html.Div(id='rpm-out'),
    dcc.Dropdown(
        id="jeep-dropdown-id",
        options=jeep_model_list,
        value='jk_2012',
    ),
    html.Div(id='jeep-model-div'),
    dcc.RadioItems(id='tranny_id',
                   options=[{