import flot from flask import Flask render_template class Fx flot Seri

 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
import flot
from flask import Flask, render_template
class Fx(flot.Series):
data = [(1412003134000,1), (1412089538000,2), (1412175941000,3)]
class MyGraph(flot.Graph):
opt = flot.SeriesOptions(color='red', label="ololo")
fx = Fx(options=opt)
app = Flask(__name__)
@app.route("/")
def main():
opts = flot.GraphOptions(xaxis={"mode": "datetime", "minTickSize": [1, "day"], "timeformat": "%d-%m-%Y" })
my_graph = MyGraph(options=opts)
print my_graph.json_data
print my_graph.options
return render_template('index.html', my_graph=my_graph)
if __name__ == "__main__":
app.run(debug=True)