forked from picarro-wtan/web-e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
82 lines (66 loc) · 2.14 KB
/
plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import flask
# from bokeh.embed import components
# from bokeh.plotting import figure
# from bokeh.resources import INLINE
# from bokeh.templates import JS_RESOURCES, CSS_RESOURCES
# from bokeh.util.string import encode_utf8
app = flask.Flask(__name__)
# colors = {
# 'Black': '#000000',
# 'Red': '#FF0000',
# 'Green': '#00FF00',
# 'Blue': '#0000FF',
# }
# def getitem(obj, item, default):
# if item not in obj:
# return default
# else:
# return obj[item]
# @app.route("/")
# def polynomial():
# """ Very simple embedding of a polynomial chart"""
# # Grab the inputs arguments from the URL
# # This is automated by the button
# args = flask.request.args
# # Get all the form arguments in the url with defaults
# color = colors[getitem(args, 'color', 'Black')]
# _from = int(getitem(args, '_from', 0))
# to = int(getitem(args, 'to', 10))
# # Create a polynomial line graph
# x = list(range(_from, to + 1))
# fig = figure(title="Polynomial")
# fig.line(x, [i ** 2 for i in x], color=color, line_width=1)
# # Configure resources to include BokehJS inline in the document.
# # For more details see:
# # http://bokeh.pydata.org/en/latest/docs/reference/resources_embedding.html#bokeh-embed
# js_resources = JS_RESOURCES.render(
# js_raw=INLINE.js_raw,
# js_files=INLINE.js_files
# )
# css_resources = CSS_RESOURCES.render(
# css_raw=INLINE.css_raw,
# css_files=INLINE.css_files
# )
# # For more details see:
# # http://bokeh.pydata.org/en/latest/docs/user_guide/embedding.html#components
# script, div = components(fig, INLINE)
# html = flask.render_template(
# 'embed.html',
# plot_script=script,
# plot_div=div,
# js_resources=js_resources,
# css_resources=css_resources,
# color=color,
# _from=_from,
# to=to
# )
# return encode_utf8(html)
# def main():
# port = int(os.environ.get('PORT', 33507))
# app.run(port=port)
@app.route('/')
def index():
return 'OK!'
if __name__ == "__main__":
# main()
app.run()