def _create_shelf(self, i=0):
"""
Creates shelf to plot a dimension (includes buttons
for data column, encoding, data type, aggregate)
"""
encodings = _get_encodings()
cols = widgets.Dropdown(options=self.columns, description='encode')
encoding = widgets.Dropdown(options=encodings, description='as',
value=encodings[i])
encoding.layout.width = '20%'
adv = widgets.VBox(children=[], visible=False)
button = widgets.Button(description='options')
button.on_click(self._show_advanced)
button.layout.width = '10%'
# The callbacks when the button is clicked
encoding.observe(self._update, names='value')
cols.observe(self._update, names='value')
# Making sure we know what row we're in in the callbacks
encoding.row = cols.row = button.row = adv.row = i
# Have the titles so we know what button we're editing
encoding.title = 'encoding'
cols.title = 'field'
button.title = 'button'
adv.title = 'advanced'
return widgets.HBox([cols, encoding, button, adv])
评论列表
文章目录