I am in a dillemma here. Here is my code here when we were talking about the function of the app.callback I was using to pass into my figure for my graph since it calculates it:
#Callback for submitting everything.
@app.callback(Output('target', 'children'), Input('submit', 'n_clicks'), Input('Categories', 'value'))
def callback(n_clicks, value):
if (n_clicks != 0):
if os.path.exists(UPLOAD_DIRECTORY):
for file in uploaded_files():
dfs = pd.read_excel(file, sheet_name=value)
dcc.Graph(
id='Concrete_Health_method',
figure= calculation(n_clicks=0, value='Spikes'),
#calculator_1.graph_concrete(df2)
style ={'display': 'inline-block'})
])
As you can see- Please look at the dfs = line How would I be able to take the code below it which is contingent upon the dfs and make it into a new and seperate function if my sheet_name is contingent upon the input(value) which needs to be defined and passed in to read the users choice for the dropdown
Anyone have any ideas?
I could put my calculation in a different function and my value(input from user) as well. However, I can’t set
figure= calculation(n_clicks=0, value='Spikes')
As I will get an error. I need a different way
Maybe if I can find some way calculation doesn’t have parameters, however, that is impossible because I need value and dfs.
I need parameters regardless as value will need to be returned in my callback decorator for my app.callback
So, I am actually in a tight predicament. I don’t know if this is even possible to resolve