On Jan 10, 2017, at 2:13 PM, Vivek Dwivedi <vivek.h.d@gmail.com> wrote:
I should also mention when I run the code below I do not get an error but my browser does not automatically launch and the data is not automatically streamed.
Thanks.
Code Below...
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, output_file, show
import numpy as np
from bokeh.server.server import Server
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler
from bokeh.application import Application
from bokeh.application.handlers import FunctionHandler
io_loop = IOLoop.current()
source = ColumnDataSource(dict(x = , y = , avg = ))
fig = figure()
fig.line(source=source, x='x', y='y', line_width = 2, alpha = .85, color ='red')
fig.line(source=source, x='x', y='avg', line_width = 2, alpha = .85, color ='blue')
ct = 0
sine_sum = 0
def update_Data(doc):
global ct, sine_sum
ct += 1
sine = np.sin(ct)
sine_sum += sine
new_data = dict(x = [ct], y = [sine], avg = [sine_sum/ct])
source.stream(new_data,100)
curdoc().add_root(fig)
curdoc().add_periodic_callback(update_Data,100)
bokeh_app = Application(FunctionHandler(update_Data))
server = Server({'/': bokeh_app}, io_loop=io_loop)
server.start()
#usage
#vivekd@Lumbergh:~/Desktop$ python -m bokeh serve --show main.py
if __name__ == '__main__':
print('Opening Bokeh application on http://localhost:5006/'\)
io_loop.add_callback(server.show, "/")
io_loop.start()
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/3d507311-1e73-4739-bb0f-4b669809beb5%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.