0

I have the following function to generate a CheckBoxGroup widget. This function depends on some other values from other widgets, and use these values to extrack the list of values to display with CheckBoxGroup:

@pn.depends(schoolSelected, nQuestionsPerExam, 
wgt_gradeLevel)
def GenerateSubeCheckboxList(schoolSelected, nQuestionsPerExam, wgt_gradeLevel):
    //implementation details are hidden
    wdt_subelerCheckbox = pn.widgets.CheckBoxGroup(name='Checkbox Group', options=list(cboxLabels), inline=True)
    return wdt_subelerCheckbox

Then, I want to create some visuals based on the selected items from the CheckBoxGroup using the following function. However, the problem is that CheckBox is created inside a function, and its options are considered empty (compiler throws an error).

@pn.depends(wdt_subelerCheckbox)
def VisualizeSubeAnalysis(wdt_subelerCheckbox):    
    df = examTakes[examTakes['ClassId'].isin(wdt_subelerCheckbox.value)]
    table_plot = df.hvplot.table(width=240)
    return table_plot

So, my question is how can I create a CheckBoxGroup whose options depends on the what is selected in other Widgets, and then create a plot based on the values selected in the CheckBoxGroup?

renakre
  • 8,001
  • 5
  • 46
  • 99

0 Answers0