Bokeh-Server: Random data dengan x axis datetime
Revision as of 19:17, 28 November 2015 by Onnowpurbo (talk | contribs) (New page: 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.1...)
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 ds.data["x"] = x ds.data["y"] = y cursession().store_objects(ds)