I am trying to get Dash to return nothing when no Data is selected. To do this I have added an if statement in my callback that should return nothing when no Data is selected.
However Dash is not clearing the existing graph.
Graph with two Data sets selected
Graph with one Data set selected
Graph with no Data set selected
In my callback I have tried getting it to return , {}, {}, None and {‘data’: }.
However they either return an error and the graph stays or they don’t return an error and the graph stays.
What should I be asking it to return so that no plot appears.
My callback:
def Make_Histograms_Graph(af,Click,Column,Min,Max,Bins,Title,Combo):
if Click < 1:
return []
else:
print(Column == [])
if Column == []:
return {'data': []}
else:
df = pd.read_json(af, orient='split')
if not df.empty:
a = Show_Histograms_Combo(df,Column,Min = Min, Max = Max, Bins = Bins, Title = Title,Combo = Combo)
return {
'data': a[0],
'layout': a[1],
}
else:
return [{}]
Using print commands I have verified that it is going into the if statement where the return “blank” is located.
I was wondering if anyone knows how to fix this.
Many Thanks