def slider(self, div_id) :
#div_id = self.show(*args, **kwargs)
def change_frame(w) :
(updates, indices) = self.get_frame(w-1)
script = ''
for i in range(len(updates)) :
jupdate = json.dumps(updates[i], cls=utils.PlotlyJSONEncoder)
#pprint(jupdate)
script = script \
+ 'Plotly.restyle("{id}", {update}, [{index}]);'.format(
id=div_id,
update=jupdate, index = indices[i][1:-1])
#print(script)
update_str = (
''
'<script type="text/javascript">' +
'window.PLOTLYENV=window.PLOTLYENV || {{}};'
'window.PLOTLYENV.BASE_URL="' + 'https://plot.ly' + '";'
'{script}' +
'</script>'
'').format(script=script)
display(HTML(update_str))
interact((lambda frame : change_frame(frame)), frame=(1,len(self.frames)))
评论列表
文章目录