Solved the problem by defining the layout in initialisation of the class with references to the methods (single_tool_pane, combined_tool_pane, weighted_tool_pane
) returning the Holoviews objects.
The plot_both
and plot_full
now become obsolete, which is cleaner.
Also a lot faster now!
weighted-choices-solved.ipynb (7.3 KB)
Thanks @Marc
layout = param.Parameter()
def __init__(self,**params):
super().__init__(**params)
single_tool_pane = pn.Row(pn.Param(self.param, parameters=['component'], show_name=False, expand=True),
self.pane_separate_bar)
combined_tool_pane = pn.Column(self.param['set_criteria_as_outer_and_tools_as_inner_label'],
self.pane_combined_bar
)
weighted_tool_pane = pn.Row(self.weights.param,
self.compute_weighted)
self.layout = pn.Column(self.description,
pn.Tabs(('single',single_tool_pane),
('combined',combined_tool_pane),
('weighted',weighted_tool_pane)))
Although it works as expected, I do get an ugly warning when creating the viewer object
WARNING:param.ParamMethod: No such watcher Watcher(inst=ParamMethod(method), cls=<class 'panel.param.ParamMethod'>, fn=<bound method Reactive.param_change of ParamMethod(method)>, mode='args', onlychanged=True, parameter_names=('align', 'aspect_ratio', 'background', 'css_classes', 'width', 'height', 'min_width', 'min_height', 'max_width', 'max_height', 'margin', 'width_policy', 'height_policy', 'sizing_mode'), what='value', queued=False) to remove.
WARNING:param.ParamMethod: No such watcher Watcher(inst=ParamMethod(method), cls=<class 'panel.param.ParamMethod'>, fn=<bound method ParamMethod._update_pane of ParamMethod(method)>, mode='args', onlychanged=True, parameter_names=('object',), what='value', queued=False) to remove.
WARNING:param.Component: No such watcher Watcher(inst=Component(deployability=3, integratability=3, name='foo', scalability=3), cls=<class '__main__.Component'>, fn=<function ParamMethod._link_object_params.<locals>.update_pane at 0x000002192FB409D8>, mode='args', onlychanged=True, parameter_names=('name', 'scalability', 'deployability', 'integratability'), what='value', queued=False) to remove.
This seems occur because I’m linking to the Component
method component.view_bar
from the Viewer
class
def pane_separate_bar(self):
return self.component.view_bar