Commit 70d10616 by BellCodeEditor

save project

parent bb9a99eb
Showing with 30 additions and 31 deletions
from pyecharts.charts import Bar from pyecharts.charts import Bar
subjects = ["浈浈", "聪聪", "小智", "波奇"]
subjects = ["18-","18-25","26-35","35-45","50+"] scores1 = [92, 95, 82, 88]
scores1 = [88,95,96,94,56] scores2 = [95, 79, 93, 90]
scores2 = [62,66,64,93]
from pyecharts.charts import Bar
bar = Bar() bar = Bar()
bar.add_xaxis(subjects) bar.add_xaxis(subjects)
bar.add_yaxis("男",scores1) bar.add_yaxis("期中",scores1,bar_width=50)
bar.add_yaxis("女",scores2) bar.add_yaxis("期末",scores2,bar_width=50)
bar.render() bar.render()
\ No newline at end of file
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
</head> </head>
<body> <body>
<div id="2f5b0170b98845c59f2b97e581090cf3" class="chart-container" style="width:900px; height:500px;"></div> <div id="f099f4d7f0cd4769bc7c49db42e2504d" class="chart-container" style="width:900px; height:500px;"></div>
<script> <script>
var chart_2f5b0170b98845c59f2b97e581090cf3 = echarts.init( var chart_f099f4d7f0cd4769bc7c49db42e2504d = echarts.init(
document.getElementById('2f5b0170b98845c59f2b97e581090cf3'), 'white', {renderer: 'canvas'}); document.getElementById('f099f4d7f0cd4769bc7c49db42e2504d'), 'white', {renderer: 'canvas'});
var option_2f5b0170b98845c59f2b97e581090cf3 = { var option_f099f4d7f0cd4769bc7c49db42e2504d = {
"animation": true, "animation": true,
"animationThreshold": 2000, "animationThreshold": 2000,
"animationDuration": 1000, "animationDuration": 1000,
...@@ -49,16 +49,16 @@ ...@@ -49,16 +49,16 @@
"series": [ "series": [
{ {
"type": "bar", "type": "bar",
"name": "\u7537", "name": "\u671f\u4e2d",
"legendHoverLink": true, "legendHoverLink": true,
"data": [ "data": [
88, 92,
95, 95,
96, 82,
94, 88
56
], ],
"showBackground": false, "showBackground": false,
"barWidth": 50,
"barMinHeight": 0, "barMinHeight": 0,
"barCategoryGap": "20%", "barCategoryGap": "20%",
"barGap": "30%", "barGap": "30%",
...@@ -77,15 +77,16 @@ ...@@ -77,15 +77,16 @@
}, },
{ {
"type": "bar", "type": "bar",
"name": "\u5973", "name": "\u671f\u672b",
"legendHoverLink": true, "legendHoverLink": true,
"data": [ "data": [
62, 95,
66, 79,
64, 93,
93 90
], ],
"showBackground": false, "showBackground": false,
"barWidth": 50,
"barMinHeight": 0, "barMinHeight": 0,
"barCategoryGap": "20%", "barCategoryGap": "20%",
"barGap": "30%", "barGap": "30%",
...@@ -106,12 +107,12 @@ ...@@ -106,12 +107,12 @@
"legend": [ "legend": [
{ {
"data": [ "data": [
"\u7537", "\u671f\u4e2d",
"\u5973" "\u671f\u672b"
], ],
"selected": { "selected": {
"\u7537": true, "\u671f\u4e2d": true,
"\u5973": true "\u671f\u672b": true
} }
} }
], ],
...@@ -154,11 +155,10 @@ ...@@ -154,11 +155,10 @@
} }
}, },
"data": [ "data": [
"18-", "\u6d48\u6d48",
"18-25", "\u806a\u806a",
"26-35", "\u5c0f\u667a",
"35-45", "\u6ce2\u5947"
"50+"
] ]
} }
], ],
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
} }
] ]
}; };
chart_2f5b0170b98845c59f2b97e581090cf3.setOption(option_2f5b0170b98845c59f2b97e581090cf3); chart_f099f4d7f0cd4769bc7c49db42e2504d.setOption(option_f099f4d7f0cd4769bc7c49db42e2504d);
</script> </script>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment