How th change the values of the x axis on the Dashboard

Hi everyone, I have been working on on Dashboard lately, it is my first one and I am not very used to Python.

I want to change the X axis on the line chart, but it won’t change and stays at 10 when I change np.arange(0, 20) for example.

Do you know how to expand the x Axis ?

Here is the code:

@app.callback(
    [Output(component_id='our_graph', component_property='figure'),
    Output(component_id='intersection', component_property='children')],
    [Input(component_id='Estimated_Annual_tCO2', component_property='value'),
    Input(component_id='Price_tCO2', component_property='value'),
    Input(component_id='Hectares_of_land', component_property='value'),
    Input(component_id='Variables_costs_ha', component_property='value'),
    Input(component_id='Gap_analysis_fee', component_property='value'),
    Input(component_id='Audit_fee', component_property='value')]
)
    
def update_graph(Est_ann_emissions, Price, Hectares_of_land, Var_costs_ha, Gap_fee, Audit_fee):
    x=np.arange(0, 11)
    y=x*Est_ann_emissions*Price
    b= 8375 + Est_ann_emissions*0.1*x + 0.05*Est_ann_emissions*x + 0.02*Est_ann_emissions*x + 2500*x + Gap_fee + Audit_fee + Hectares_of_land*Var_costs_ha
    fig = go.Figure()
    fig.add_trace(go.Scatter(x=x, y=y, name='Turnover')),
    fig.add_trace(go.Scatter(x=x, y=b, name='Costs'))
    bep = interp1d(y - b, x)(0)

    return fig, bep

and here is what it does on the graph:

Thanks so much for your help guys ! :wink:

Hi @marquymarc

If I change the np.arange(0, 20) I get this:

Hi Eduardo, I don’t know why it was not working this morning but I managed to find too, thank you so much for your help !

1 Like

@marquymarc

Check if the debug is True or False:

if __name__ == '__main__':
    app.run_server(debug=True)