Hi Bryan,
Thanks a lot your advise was perfect. My code is working but just with Dropdown tool and in the Bokeh server not the HTML.
Details:
My first problem was the If function, not properly write. The second was that I was not using a Iniatial state of Update_cast
update_cast(None, None, None) # initial load of the data
Now my code is working with the Dropdown tools but not with the RatioButton. The error I have is I need 4 arguments (way button is working) but I do not know how to do it. I add *def update_cast(active, attrname, old, new): *but not working.
self.on_change(‘active’, lambda attr, old, new: handler(new))
TypeError: update_cast() missing 3 required positional arguments: ‘attrname’, ‘old’, and ‘new’
I can use the Dropdown but I would like to work with RatoButton.
The code:
def select_cast():
cast_val = cast_select.value
selected = df1
if (cast_val != “Both”):
selected = selected[selected.Flag.str.contains(cast_val)==True]
return selected
def update_cast(attrname, old, new):
df = select_cast()
source.data = dict(
Pressure=df[“Pressure”],
Depth=df[“Depth”],
Temperature=df[“Temperature”],
Salinity=df[“Salinity”],
Conductivity=df[“Conductivity”],
Density=df[“Density”],
DescentRate=df[“Descent Rate”],
SoundVelocity=df[“Sound Velocity”],
Oxygenraw=df[“Oxygen raw”],
Oxygenmgl=df[“Oxygen [mg/l]”],
Oxygenpercent=df[“Oxygen [%]”],
Flag=df[“Flag”]
)
controls = [cast_select]
for control in controls:
control.on_change(‘value’, update_cast)
update_cast(None, None, None) # initial load of the data
``
Maria