Bokeh-Server: Random data dengan x axis datetime
Revision as of 19:37, 28 November 2015 by Onnowpurbo (talk | contribs)
import sys import time import socket import random import datetime from bokeh.plotting import figure, output_server, show, cursession output_server("randomaja",url='http://192.168.0.100:5006') x = [0] y = [0] for i in xrange(10000): n = datetime.datetime.now() x += [time.mktime(n.timetuple())] y += [random.random()] print x[i] print " " print y[i] print "\n" p = figure(x_axis_type="datetime") p.line(x, y, name='randomaja') show(p) renderer = p.select(dict(name="randomaja")) ds = renderer[0].data_source i = 0 while True: for i in xrange(10000): ds.data["x"] = x[i] ds.data["y"] = y[i] cursession().store_objects(ds) time.sleep(0.1)