refresh web page in the localhost disable autoscale. Why ?

Hello,

In this python script used on fedora (linux), a plot of a cosinus signal with noise is send to a web page. We can see a bokeh plot with the function autoscale activated. But when I refresh the page in the localhost, the function autoscale is disabled. I want an activated function autoscale even if I refresh the web page. How to do ?

Python2.7 script:

if name == ‘main’:
import ctypes
import sys
if sys.platform.startswith(‘linux’):
try:
x11 = ctypes.cdll.LoadLibrary(‘libX11.so’)
x11.XInitThreads()
except:
print “Warning: failed to XInitThreads()”

from bokeh.client import push_session
from bokeh.plotting import curdoc
from gnuradio import analog
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import bokehgui
import functools
import signal
import time

class top_block(gr.top_block):
def init(self, doc):
gr.top_block.init(self, “Top Block”)
self.doc = doc
self.plot_lst =
self.widget_lst =

···
    ##################################################
    # Variables
    ##################################################
    self.samp_rate = samp_rate = 32000

    ##################################################
    # Blocks
    ##################################################
    self.bokehgui_frequency_sink_x_0 = bokehgui.freq_sink_f_proc(1024,
                         firdes.WIN_BLACKMAN_hARRIS,
                         0, samp_rate,
                         "", 1)
    self.bokehgui_frequency_sink_x_0_plot = bokehgui.freq_sink_f(self.doc, self.plot_lst, self.bokehgui_frequency_sink_x_0, is_message = False)

    labels = ['', '', '', '', '',
              '', '', '', '', '']
    legend_list = []

    for i in xrange(1):
        if len(labels[i]) == 0:
            legend_list.append("Data {0}".format(i))
        else:
            legend_list.append(labels[i])

    self.bokehgui_frequency_sink_x_0_plot.initialize(update_time = 100,
                               legend_list = legend_list)

    self.bokehgui_frequency_sink_x_0_plot.set_y_axis([-100, -10])
    self.bokehgui_frequency_sink_x_0_plot.set_y_label('Relative Gain' + '(' +'dB'+')')
    self.bokehgui_frequency_sink_x_0_plot.set_x_label('Frequency')

    self.bokehgui_frequency_sink_x_0_plot.set_trigger_mode(bokehgui.TRIG_MODE_FREE,0.0, 0, "")

    self.bokehgui_frequency_sink_x_0_plot.enable_grid(True)
    self.bokehgui_frequency_sink_x_0_plot.enable_axis_labels(True)
    self.bokehgui_frequency_sink_x_0_plot.disable_legend(not True)
    self.bokehgui_frequency_sink_x_0_plot.set_plot_pos_half(False)
    self.bokehgui_frequency_sink_x_0_plot.set_layout(*(((1,0))))
    colors = ["blue", "red", "green", "black", "cyan",
              "magenta", "yellow", "dark red", "dark green", "dark blue"]
    widths = [1, 1, 1, 1, 1,
              1, 1, 1, 1, 1]
    styles = ["solid", "solid", "solid", "solid", "solid",
              "solid", "solid", "solid", "solid", "solid"]
    markers = [None, None, None, None, None,
               None, None, None, None, None]
    alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
              1.0, 1.0, 1.0, 1.0, 1.0]

    for i in xrange(1):
        self.bokehgui_frequency_sink_x_0_plot.format_line(i, colors[i], widths[i], styles[i], markers[i], alphas[i])

    self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
    self.blocks_add_xx_0 = blocks.add_vff(1)
    self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
    self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, .01, 0)

    if self.widget_lst:
        input_t = bokehgui.BokehLayout.widgetbox(self.widget_lst)
        widgetbox = bokehgui.BokehLayout.WidgetLayout(input_t)
        widgetbox.set_layout(*((0, 0)))
        list_obj = [widgetbox] + self.plot_lst
    else:
        list_obj = self.plot_lst
    layout_t = bokehgui.BokehLayout.create_layout(list_obj, "fixed")
    self.doc.add_root(layout_t)

    ##################################################
    # Connections
    ##################################################
    self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1))
    self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0))
    self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
    self.connect((self.blocks_throttle_0, 0), (self.bokehgui_frequency_sink_x_0, 0))

def get_samp_rate(self):
    return self.samp_rate

def set_samp_rate(self, samp_rate):
    self.samp_rate = samp_rate
    self.bokehgui_frequency_sink_x_0.set_frequency_range(0, self.samp_rate)
    self.blocks_throttle_0.set_sample_rate(self.samp_rate)
    self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)

def main(top_block_cls=top_block, options=None):

serverProc, port = bokehgui.utils.create_server()
def killProc(signum, frame, tb):
    tb.stop()
    tb.wait()
    serverProc.terminate()
    serverProc.kill()
time.sleep(6)
try:
    # Define the document instance
    doc = curdoc()
    doc.title = "Top Block"
    session = push_session(doc, session_id="top_block",
                           url = "http://localhost:" + port + "/bokehgui")
    # Create Top Block instance
    tb = top_block_cls(doc)
    try:
        tb.start()
        signal.signal(signal.SIGTERM, functools.partial(killProc, tb=tb))
        session.loop_until_closed()
    finally:
        print "Exiting the simulation. Stopping Bokeh Server"
        tb.stop()
        tb.wait()
finally:
    serverProc.terminate()
    serverProc.kill()

if name == ‘main’:
main()