Open amoghskulkarni opened 7 years ago
Can be done either with the help of -
source = None
widgets_states = {}
self.data = DataFrame({'Adder.sum': parseutils.getValues('Adder.sum'),
'Adder.a': parseutils.getValues('Adder.a'),
'Adder.b': parseutils.getValues('Adder.b')})
# step calculation
self.Adder_a__step = 0.1
self.Adder_b__step = 0.1
# bokeh config
output_notebook()
source = ColumnDataSource(data=self.data)
self.p = figure(title='AdderDOEProblem')
self.p.add_tools(HoverTool())
self.r = self.p.circle('Adder.a', 'Adder.sum', source=source, size=3, alpha=0.5)
# Widgets states
widgets_states['Domain'] = 'Adder.a'
widgets_states['Range'] = 'Adder.sum'
# Widgets callbacks
def dummy_callback(source=source, window=None):
data = source.data
x, y = data['Adder.a'], data['Adder.sum']
widgets_states[cb_obj.title] = cb_obj.value ## <------- THE CAUSE OF ERROR. THIS IS NOT ALLOWED.
source.trigger('change')
# Widgets stuff
domain_options = ['Adder.a', 'Adder.b']
range_options = ['Adder.sum']
w_domain_dropdown = Select(options=domain_options, title='Domain', value='Adder.a', callback=CustomJS.from_py_func(dummy_callback))
w_range_dropdown = Select(options=range_options, title='Range', value='Adder.sum', callback=CustomJS.from_py_func(dummy_callback))
self.widgets = widgetbox(w_domain_dropdown, w_range_dropdown)
AdderDOEProblem_plotutils.zip for bokeh AdderDOEProblem_plotutils.zip for bqplot
This SO answer solves the problem. The layout still needs to be fitted into window of the browser, but basic problem (widgets not being rendered) is solved.
Need to integrate bqplot into the plotting now.
In iPython notebook, make them appear in one single cell horizontally aligned.