Dropdown callback from clickdata

i’m writing a code with a sunburst chart that will present all classes from some type of data, and when the user click on what class he wanna see my dropdown menu should present values only from that classe.

So, my difficult where how to do this callback, cause all the ways that i tried failed.

#callback for data_table values
#my original dropdown present all values from my df

@app.callback(
    Output(component_id="dropdown-value", component_property='value'), 
    Input(component_id = 'pie_class_chart', component_property='clickData'))


#until here, thats ok. 

def update_dd_w_click_data(clickData):

#Value are my variable that store what class the user select, working well
#the problem is that my except condition always print "error" 
    
    try:
        value = clickData['points'][0]['label']
        return dcc.Dropdown([dff['type'] == value])
    except:
        print('error')

using the tool toggleerror from my dash, i receive back:

Invalid argument `value` passed into Dropdown with ID "dropdown-value".
Value provided: 
{
  "props": {
    "options": [
      [
        false,
        false,
        false,
        true,
        true,
        false,

how get the values and not “true” and “false” on dropdown.

Hello @theeconomist,

Welcome to the community.

It looks like you need to make some changes. You are filtering, but you arent giving it information.

Something along the lines of this:

#callback for data_table values
#my original dropdown present all values from my df

@app.callback(
    Output(component_id="dropdown-value", component_property='value'), 
    Input(component_id = 'pie_class_chart', component_property='clickData'))


#until here, thats ok. 

def update_dd_w_click_data(clickData):

#Value are my variable that store what class the user select, working well
#the problem is that my except condition always print "error" 
    
    try:
        value = clickData['points'][0]['label']
        return dcc.Dropdown(dff[dff['type'] == value]]['type'])
    except:
        print('error')
1 Like

dont solve the doubt. Now my errortoggle return this

Invalid argument `value` passed into Dropdown with ID "dropdown-value".
Value provided: 
{
  "props": {
    "options": [
      "Macro Alta Vol",
      "Macro Alta Vol",
      "Macro Alta Vol",
      "Macro Alta Vol",
      "Macro Alta Vol",

Exactly where i clicked, but my dropdown dont present any difference. I should be seeing this in my dropdown

#callback for data_table values
#my original dropdown present all values from my df

@app.callback(
    Output(component_id="dropdown-value", component_property='options'), 
    Input(component_id = 'pie_class_chart', component_property='clickData'))


#until here, thats ok. 

def update_dd_w_click_data(clickData):

#Value are my variable that store what class the user select, working well
#the problem is that my except condition always print "error" 
    
    try:
        value = clickData['points'][0]['label']
        return dcc.Dropdown(dff[dff['type'] == value]]['type'])
    except:
        print('error')

Changed it from value to options for the output.

1 Like