Jupyter notebook 无法为Dash(JupyterDash)触发具有多个文本输入的回调

Jupyter notebook 无法为Dash(JupyterDash)触发具有多个文本输入的回调,jupyter-notebook,plotly-dash,Jupyter Notebook,Plotly Dash,我试图让dash使用多个输入触发,无论出于什么原因,一旦我添加了一个额外的输入,我就再也看不到触发器了。我曾尝试在回调中放置断点,但似乎从来没有初始触发器或用户激活的触发器 此问题仅在添加第二个文本输入时发生 from jupyter_dash import JupyterDash import dash import dash_core_components as dcc import dash_html_components as html import plotly.express as

我试图让dash使用多个输入触发,无论出于什么原因,一旦我添加了一个额外的输入,我就再也看不到触发器了。我曾尝试在回调中放置断点,但似乎从来没有初始触发器或用户激活的触发器

此问题仅在添加第二个文本输入时发生

from jupyter_dash import JupyterDash
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
from dash.dependencies import Input, Output

app = JupyterDash(__name__)
app.layout = html.Div([
    html.H1("JupyterDash Demo"),
    html.Label('Loan amount'),
    dcc.Input(id='loanInput',  value="100000",type='number', placeholder=""),
    dcc.Input(id='interestInput',  value="3",type='number', placeholder=""),

    dcc.Graph(id='graph')])

@app.callback(
    Output(component_id='graph', component_property='figure'),
    [Input(component_id="loanInput", component_property="value"),
    Input(component_id="interestInput", component_property="value")])
def update_figure(i1,i2):
    df,m = getLoanData(loanAmount=i1, interest=i2)
    fig =  px.line(df, x=df.number, y=df.columns, range_y=(0,500000), title="Total Cost of Home Loan")
    return fig

app.run_server(mode='inline',debug=True)
这个例子很好:

from jupyter_dash import JupyterDash
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
from dash.dependencies import Input, Output

app = JupyterDash(__name__)
app.layout = html.Div([
    html.H1("JupyterDash Demo"),
    html.Label('Loan amount'),
    dcc.Input(id='loanInput',  value="100000",type='number', placeholder=""),

    dcc.Graph(id='graph')])

@app.callback(
    Output(component_id='graph', component_property='figure'),
    Input(component_id="loanInput", component_property="value"))
def update_figure(i1):
    df,m = getLoanData(loanAmount=i1)
    fig =  px.line(df, x=df.number, y=df.columns, range_y=(0,500000), title="Total Cost of Home Loan")
    return fig

app.run_server(mode='inline',debug=True)
这是文本输入框中每次更改都会触发的输出(在我更改初始值之后)

一旦我添加了第二个文本输入,它就不会再触发任何一个文本输入的更改

from jupyter_dash import JupyterDash
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
from dash.dependencies import Input, Output

app = JupyterDash(__name__)
app.layout = html.Div([
    html.H1("JupyterDash Demo"),
    html.Label('Loan amount'),
    dcc.Input(id='loanInput',  value="100000",type='number', placeholder=""),
    dcc.Input(id='interestInput',  value="3",type='number', placeholder=""),

    dcc.Graph(id='graph')])

@app.callback(
    Output(component_id='graph', component_property='figure'),
    [Input(component_id="loanInput", component_property="value"),
    Input(component_id="interestInput", component_property="value")])
def update_figure(i1,i2):
    df,m = getLoanData(loanAmount=i1, interest=i2)
    fig =  px.line(df, x=df.number, y=df.columns, range_y=(0,500000), title="Total Cost of Home Loan")
    return fig

app.run_server(mode='inline',debug=True)
无论我提供什么输入,这里的输出都不会改变。


为什么没有使用多个输入触发回调?

您确定回调没有触发吗?有没有可能它正在发射,但返回的数字是空的?