Hey guys,
i have some problems with my callback. I want to reset my dataframe after deleting some points of my graph. But the problem is when i do it twice or more and click on my reset button the first deleted points are shown but not the others. Therefore i have to select some points in my graph to get the other points back. I dont know where my mistake is. Here is my callback:
app.callback(
Output("graph2","figure"),
[Input("kind2","value"),
Input("tab2","derived_virtual_data"),
Input("reset","n_clicks"),
Input("delete","n_clicks")]
)
def get_figure(input1,rows,clicks,kicks_all):
global n, df_input,df_input2,array,kick
if clicks==None:
clicks=0
if kicks_all==None:
kicks_all=0
if clicks>n:
n=n+1
df_input=pd.DataFrame(df_input2)
if rows!=None:
liste=[i["Time Start"] for i in rows]
for x in array:
if str(x).replace(" ","T") not in liste:
df_input.drop(df_input[df_input["Time Start"]==x].index,axis=0,inplace=True)
fig=px.scatter(x=df_input["Time Start"],y=df_input[input1])
fig.update_traces(
customdata=df_input.index,
mode='markers+text', )
fig.update_layout(dragmode='select', hovermode=False,transition_duration=500)
return fig
I hope you can help my. Thanks