I did not manage to get it fixed. Could ye help me out. I stopped the if statement earlier to simply the code here. Still I was looking into some nested loops for JS, perhaps a for loop to make the other plots not visible, instead write one by one this way.
r = gridplot([[pw, pp, pf, pl]], merge_tools=True, toolbar_location='below', width=190, height=160)
dfL = pd.read_csv(f'dfL{year}.csv', delimiter=',', index_col=0)
pL = LPlot(dfL, year)
t1 = Panel(child=pCons, title='Overall')
t2 = Panel(child =pL, title='By Grand Prix')
tabs = Tabs(tabs= [t1, t2])
col = column([tabs, r], align='start')
return col
>
> def tabs():
> t04, t05, t06, t07, t08, t09, t10 = Constplot(2004), Constplot(2005), Constplot(2006), Constplot(2007), Constplot(2008), Constplot(2009), Constplot(2010)
> t11, t12, t13, t14, t15, t16, t17 = Constplot(2011), Constplot(2012), Constplot(2013), Constplot(2014), Constplot(2015),Constplot(2016), Constplot(2017)
> t18, t19, t20, t21 = Constplot(2018), Constplot(2019), Constplot(2020), Constplot(2021)
> select = Select(title='Select year:', align='start', value='Campionship 2021', options=['Campionship 2021', 'Campionship 2020',
> 'Campionship 2019', 'Campionship 2018',
> 'Campionship 2017','Campionship 2016',
> 'Campionship 2015','Campionship 2014',
> 'Campionship 2013','Campionship 2012',
> 'Campionship 2011','Campionship 2010',
> 'Campionship 2009','Campionship 2008',
> 'Campionship 2007','Campionship 2006',
> 'Campionship 2005','Campionship 2004'])
>
> select.js_on_change('value', CustomJS(args=dict(t21=t21, t20=t20, t19=t19, t18=t18, t17=t17, t16=t16,
> t15=t15, t14=t14, t13=t13, t12=t12, t11=t11, t10=t10,
> t09=t09, t08=t08, t07=t07, t06=t06, t05=t05,t04=t04,
> select=select), code='''
> if (select.value=='Campionship 2021'){
> t21.visible=true
> t20.visible=false
> ....}
> ...else {
> ...
> t04.visible=visible}'''
> ))
>
> show(column([select, t21, t20, t19, t18, t17, t16, t15, t14, t13,t12,t11,t10,t09,t08,t07,t06,t05,t04]))
> tabs()
@gmerritt123