from flask import Flask, render_template
import json
from models import Chart
app = Flask(__name__)
@app.route("/")
def index():
chart1 = Chart().pie("饼图", data={
u"衬衫": 100,
u"羊毛衫": 360,
u"雪纺衫": 120,
u"裤子": 500,
u"高跟鞋": 300
})
chart2 = Chart() \
.legend(data=[u"最高气温", u"最低气温"]) \
.x_axis(data=[u"周一", u"周二", u"周三", u"周四", u"周五", u"周六", u"周日"]) \
.y_axis(formatter="{value} C") \
.line(u"最高气温", [10, 20, 30, 40, 30, 20, 10], mark_max_point=True, show_item_label=True) \
.bar(u"最低气温", [5, 10, 5, 10, 5, 6, 7]) \
.pie(name="测试", data={"Java": 50, "PHP": 50, "Python": 100}, center=["20%", "30%"], radius="15%")
print json.dumps(chart2, indent=2)
render = {
"title": u"测试的标题",
"templates": [
{"type": "radio"},
{"type": "table"},
{"type": "chart", "option": json.dumps(chart1, indent=2)},
{"type": "chart", "option": json.dumps(chart2, indent=2)}
]
}
return render_template("main.html", **render)
py-echarts's Introduction
py-echarts's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.