def make_model(typename, **kwargs): """the server should use this make_model function, it automatically passes in a model client to all models too much magic? (@hugo) """ from flask import g if 'client' not in kwargs and hasattr(g, 'client'): return bbmodel.make_model(typename, client=g.client, **kwargs) return bbmodel.make_model(typename, **kwargs)
source = make_model('ObjectArrayDataSource', data=[ { 'x': 1, 'y': 5, 'z': 3, 'radius': 10 }, { 'x': 2, 'y': 4, 'z': 3 }, { 'x': 3, 'y': 3, 'z': 3, 'color': "red" }, { 'x': 4, 'y': 2, 'z': 3 }, { 'x': 5, 'y': 1, 'z': 3 }, ]) plot = make_model('Plot')
else: LOCAL = False if LOCAL: p = mpl.PlotClient() else: p = mpl.PlotClient('defaultuser', serverloc='http://localhost:5006', userapikey='nokey') p.use_doc('glyph') source = make_model( 'ObjectArrayDataSource', data = [ {'x' : 1, 'y' : 5, 'z':3, 'radius':10}, {'x' : 2, 'y' : 4, 'z':3}, {'x' : 3, 'y' : 3, 'z':3, 'color':"red"}, {'x' : 4, 'y' : 2, 'z':3}, {'x' : 5, 'y' : 1, 'z':3}, ] ) plot = make_model('Plot') xdr = make_model( 'DataRange1d', sources = [{'ref' : source.ref(), 'columns' : ['x']}] ) ydr = make_model( 'DataRange1d', sources=[{'ref' : source.ref(), 'columns' : ['y']}], ) glyph_renderer = make_model(