Hi,
I am just starting to mess around with Bokeh, and I’m having a little trouble with getting a simple program to work. I just want the program to dynamically update a simple line plot within a browser. The code is below:
#!/usr/bin/python
import numpy as np
from bokeh.client import push_session
from bokeh.plotting import figure, curdoc
COLOR = “orange”
NUM_CALLBACKS = 500
PLOT_WIDTH = NUM_CALLBACKS
PLOT_HEIGHT = 10
MAX_TIME = 5000
CUR_TIME = 0
CUR_ACCEL = 1
FIGURE = figure(x_range=(0, PLOT_WIDTH), y_range=(0, PLOT_HEIGHT))
FIGURE.border_fill_color = ‘white’
FIGURE.background_fill_color = ‘white’
LINE = FIGURE.line(x = , y = , color = COLOR)
session = push_session(curdoc())
def callback():
‘’’
‘’’
global CUR_TIME
global CUR_ACCEL
CUR_TIME += 1
CUR_ACCEL *= 1.01
LINE.data_source.data[‘x’].append(CUR_TIME)
LINE.data_source.data[‘y’].append(CUR_ACCEL)
print(str((CUR_TIME, CUR_ACCEL)))
curdoc().add_periodic_callback(callback, 100)
I am invoking this program with ‘$bokeh serve test.py --show’, and when I run it, I get the following error message:
“IOError: Cannot push session document because we failed to connect to the server (to start the server, try the ‘bokeh serve’ command)”
I would really appreciate any help I can get with this.
I want to be able to greatly generalize the functionality within this simple program an application I’m building for my school’s FSAE team. I’m working on an application for our pit crew that will monitor the health of our vehicle (by displaying dynamically updating metrics and plots from data sent to the pit station with an Xbee radio). Ideally, I’d like to have a dashboard of 6-7 plots that are being updated with callback functions as data is received from the vehicle. So, if anyone has any experience with integrating Bokeh API’s with the Python Xbee Library for a similar application and can point me in a direction of some good examples, that would also be a great help.
-Ricky