Commit 5bc6e935 by BellCodeEditor

save project

parent 54d9cd84
Showing with 49 additions and 26 deletions
from pyecharts.charts import Bar from pyecharts.charts import Bar
bar = Bar() bar = Bar()
subjects = ["语文","数学","英语","地理","历史","政治","生物","化学","物理"] studens_name = ["真真","匆匆","吱吱","麒麒"]
scores = [88, 95, 96, 94, 62, 66, 64, 93, 89] scores = [88, 95, 96, 94]
bar.add_xaxis(subjects) scores2 = [98,79,93,90]
bar.add_yaxis("得分",scores) bar.add_xaxis(studens_name)
bar.add_yaxis("期中分数",scores,bar_width=40)
bar.add_yaxis("期末分数",scores2,bar_width=40)
bar.render('zhuzhuangtu.html') bar.render('zhuzhuangtu.html')
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
</head> </head>
<body> <body>
<div id="dc8a4b18e8e7493aab3d7e631485af98" class="chart-container" style="width:900px; height:500px;"></div> <div id="c563ecab3f2b44a685703ac3e2a94796" class="chart-container" style="width:900px; height:500px;"></div>
<script> <script>
var chart_dc8a4b18e8e7493aab3d7e631485af98 = echarts.init( var chart_c563ecab3f2b44a685703ac3e2a94796 = echarts.init(
document.getElementById('dc8a4b18e8e7493aab3d7e631485af98'), 'white', {renderer: 'canvas'}); document.getElementById('c563ecab3f2b44a685703ac3e2a94796'), 'white', {renderer: 'canvas'});
var option_dc8a4b18e8e7493aab3d7e631485af98 = { var option_c563ecab3f2b44a685703ac3e2a94796 = {
"animation": true, "animation": true,
"animationThreshold": 2000, "animationThreshold": 2000,
"animationDuration": 1000, "animationDuration": 1000,
...@@ -49,20 +49,44 @@ ...@@ -49,20 +49,44 @@
"series": [ "series": [
{ {
"type": "bar", "type": "bar",
"name": "\u5f97\u5206", "name": "\u671f\u4e2d\u5206\u6570",
"legendHoverLink": true, "legendHoverLink": true,
"data": [ "data": [
88, 88,
95, 95,
96, 96,
94, 94
62, ],
66, "showBackground": false,
64, "barWidth": 40,
"barMinHeight": 0,
"barCategoryGap": "20%",
"barGap": "30%",
"large": false,
"largeThreshold": 400,
"seriesLayoutBy": "column",
"datasetIndex": 0,
"clip": true,
"zlevel": 0,
"z": 2,
"label": {
"show": true,
"position": "top",
"margin": 8
}
},
{
"type": "bar",
"name": "\u671f\u672b\u5206\u6570",
"legendHoverLink": true,
"data": [
98,
79,
93, 93,
89 90
], ],
"showBackground": false, "showBackground": false,
"barWidth": 40,
"barMinHeight": 0, "barMinHeight": 0,
"barCategoryGap": "20%", "barCategoryGap": "20%",
"barGap": "30%", "barGap": "30%",
...@@ -83,10 +107,12 @@ ...@@ -83,10 +107,12 @@
"legend": [ "legend": [
{ {
"data": [ "data": [
"\u5f97\u5206" "\u671f\u4e2d\u5206\u6570",
"\u671f\u672b\u5206\u6570"
], ],
"selected": { "selected": {
"\u5f97\u5206": true "\u671f\u4e2d\u5206\u6570": true,
"\u671f\u672b\u5206\u6570": true
} }
} }
], ],
...@@ -129,15 +155,10 @@ ...@@ -129,15 +155,10 @@
} }
}, },
"data": [ "data": [
"\u8bed\u6587", "\u771f\u771f",
"\u6570\u5b66", "\u5306\u5306",
"\u82f1\u8bed", "\u5431\u5431",
"\u5730\u7406", "\u9e92\u9e92"
"\u5386\u53f2",
"\u653f\u6cbb",
"\u751f\u7269",
"\u5316\u5b66",
"\u7269\u7406"
] ]
} }
], ],
...@@ -165,7 +186,7 @@ ...@@ -165,7 +186,7 @@
} }
] ]
}; };
chart_dc8a4b18e8e7493aab3d7e631485af98.setOption(option_dc8a4b18e8e7493aab3d7e631485af98); chart_c563ecab3f2b44a685703ac3e2a94796.setOption(option_c563ecab3f2b44a685703ac3e2a94796);
</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