Bokeh resize plot dynamically

2019-08-18 17:54发布

问题:

i have Bokeh 0.12.6, what i do

p2 = figure(x_axis_type="datetime", plot_width=1500,plot_height=700,
            x_range=p1.x_range, title="")
select = Select(title="SELECT", options=["val1", "val2", "val3"])
select.callback = CustomJS(args={'plot1': p1, 'plot2': p2}, code="""
        if(cb_obj.value === "val1"){
            plot2.width = 1500;
        }else{ 
            plot2.width = 700;
        }
        plot2.document.resize();

    """)

I need to resize plot by clicking dropdown but i recieve js error that document.resize is not a function. Also i tried plot2.change.emit(); but plot changed only if i change display width in Chrome. How to dinamically change plot properties such as width, height, lines properies etc.. ? Thanks.

回答1:

Bokeh used to have resize but it died recently and won't get revived from what I read.