Commit 6e796d2a by BellCodeEditor

save project

parent c23df256
Showing with 172 additions and 56 deletions
from pyecharts.charts import Bar from pyecharts.charts import Bar
subjects = ["浈浈", "聪聪", "小智", "波奇"] subjects = ["浈浈", "聪聪", "小智", "波奇"]
scores1 = [92, 95, 82, 88] # 期中成绩 scores1 = [92, 95, 82, 88] # 期中成绩
scores2 = [95, 79, 93, 90] # 期末成绩 scores2 = [95, 79, 93, 90] # 期末成绩
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
</head> </head>
<body> <body>
<div id="d7bd9c7e0c514dcbbb0caaee4268ad12" class="chart-container" style="width:900px; height:500px;"></div> <div id="7efadd3c7289463b9451f584fc64cab0" class="chart-container" style="width:900px; height:500px;"></div>
<script> <script>
var chart_d7bd9c7e0c514dcbbb0caaee4268ad12 = echarts.init( var chart_7efadd3c7289463b9451f584fc64cab0 = echarts.init(
document.getElementById('d7bd9c7e0c514dcbbb0caaee4268ad12'), 'white', {renderer: 'canvas'}); document.getElementById('7efadd3c7289463b9451f584fc64cab0'), 'white', {renderer: 'canvas'});
var option_d7bd9c7e0c514dcbbb0caaee4268ad12 = { var option_7efadd3c7289463b9451f584fc64cab0 = {
"animation": true, "animation": true,
"animationThreshold": 2000, "animationThreshold": 2000,
"animationDuration": 1000, "animationDuration": 1000,
...@@ -48,71 +48,171 @@ ...@@ -48,71 +48,171 @@
], ],
"series": [ "series": [
{ {
"type": "bar", "type": "line",
"name": "\u671f\u4e2d\u6210\u7ee9", "name": "\u964d\u6c34\u91cf",
"legendHoverLink": true, "connectNulls": false,
"data": [ "symbolSize": 4,
92, "showSymbol": true,
95, "smooth": false,
82,
88
],
"showBackground": false,
"barWidth": 40,
"barMinHeight": 0,
"barCategoryGap": "20%",
"barGap": "30%",
"large": false,
"largeThreshold": 400,
"seriesLayoutBy": "column",
"datasetIndex": 0,
"clip": true, "clip": true,
"zlevel": 0, "step": false,
"z": 2, "data": [
[
"1\u6708",
2.6
],
[
"2\u6708",
5.9
],
[
"3\u6708",
9.0
],
[
"4\u6708",
26.4
],
[
"5\u6708",
28.7
],
[
"6\u6708",
76.7
],
[
"7\u6708",
175.6
],
[
"8\u6708",
182.2
],
[
"9\u6708",
48.7
],
[
"10\u6708",
18.8
],
[
"11\u6708",
6.0
],
[
"12\u6708",
2.3
]
],
"hoverAnimation": true,
"label": { "label": {
"show": true, "show": true,
"position": "top", "position": "top",
"margin": 8 "margin": 8
} },
"lineStyle": {
"show": true,
"width": 1,
"opacity": 1,
"curveness": 0,
"type": "solid"
},
"areaStyle": {
"opacity": 0
},
"zlevel": 0,
"z": 0
}, },
{ {
"type": "bar", "type": "line",
"name": "\u671f\u672b\u6210\u7ee9", "name": "\u84b8\u53d1\u91cf",
"legendHoverLink": true, "connectNulls": false,
"data": [ "symbolSize": 4,
95, "showSymbol": true,
79, "smooth": false,
93,
90
],
"showBackground": false,
"barWidth": 40,
"barMinHeight": 0,
"barCategoryGap": "20%",
"barGap": "30%",
"large": false,
"largeThreshold": 400,
"seriesLayoutBy": "column",
"datasetIndex": 0,
"clip": true, "clip": true,
"zlevel": 0, "step": false,
"z": 2, "data": [
[
"1\u6708",
2.6
],
[
"2\u6708",
5.9
],
[
"3\u6708",
9.0
],
[
"4\u6708",
26.4
],
[
"5\u6708",
28.7
],
[
"6\u6708",
76.7
],
[
"7\u6708",
175.6
],
[
"8\u6708",
182.2
],
[
"9\u6708",
48.7
],
[
"10\u6708",
18.8
],
[
"11\u6708",
6.0
],
[
"12\u6708",
2.3
]
],
"hoverAnimation": true,
"label": { "label": {
"show": true, "show": true,
"position": "top", "position": "top",
"margin": 8 "margin": 8
} },
"lineStyle": {
"show": true,
"width": 1,
"opacity": 1,
"curveness": 0,
"type": "solid"
},
"areaStyle": {
"opacity": 0
},
"zlevel": 0,
"z": 0
} }
], ],
"legend": [ "legend": [
{ {
"data": [ "data": [
"\u671f\u4e2d\u6210\u7ee9", "\u964d\u6c34\u91cf",
"\u671f\u672b\u6210\u7ee9" "\u84b8\u53d1\u91cf"
], ],
"selected": { "selected": {
"\u671f\u4e2d\u6210\u7ee9": true, "\u964d\u6c34\u91cf": true,
"\u671f\u672b\u6210\u7ee9": true "\u84b8\u53d1\u91cf": true
} }
} }
], ],
...@@ -155,10 +255,18 @@ ...@@ -155,10 +255,18 @@
} }
}, },
"data": [ "data": [
"\u6d48\u6d48", "1\u6708",
"\u806a\u806a", "2\u6708",
"\u5c0f\u667a", "3\u6708",
"\u6ce2\u5947" "4\u6708",
"5\u6708",
"6\u6708",
"7\u6708",
"8\u6708",
"9\u6708",
"10\u6708",
"11\u6708",
"12\u6708"
] ]
} }
], ],
...@@ -186,7 +294,7 @@ ...@@ -186,7 +294,7 @@
} }
] ]
}; };
chart_d7bd9c7e0c514dcbbb0caaee4268ad12.setOption(option_d7bd9c7e0c514dcbbb0caaee4268ad12); chart_7efadd3c7289463b9451f584fc64cab0.setOption(option_7efadd3c7289463b9451f584fc64cab0);
</script> </script>
</body> </body>
</html> </html>
from pyecharts.charts import Line
x = ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月",]
y = [2.6,5.9,9.0,26.4,28.7,76.7,175.6,182.2,48.7,18.8,6.0,2.3]
line = Line()
line.add_xaxis(x)
line.add_yaxis("降水量",y)
line.add_yaxis("蒸发量",y)
line.render()
\ No newline at end of file
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