Commit 10dc6d10 by BellCodeEditor

save project

parent 90f1cdc5
Showing with 242 additions and 63 deletions
from pyecharts.charts import Line from pyecharts.charts import Line
subjects = ["浈浈", "聪聪", "小智", "波奇"] subjects = ["第1次","第2次","第3次","第4次","第5次","第6次","第7次","第8次","第9次","第10次" ]
scores1 = [150, 95, 82, 88] # scores1 = [112,110,118,124,129,132,136,139,134,143] # 聪聪
scores2 = [95, 79, 93, 90] # scores2 = [128,131,132,139,130,127,129,131,132,128] # 小杰
bar=Line() scores3 = [143,145,140,133,134,126,121,120,114,105] # 皮皮
bar.add_xaxis(subjects) #创建折线图对象
bar.add_yaxis("期中成绩",scores1,bar_width=40) line=Line()
bar.add_yaxis("期末成绩",scores2,bar_width=40) #传入x,y数值
bar.render() line.add_xaxis(subjects)
\ No newline at end of file
line.add_yaxis("聪聪",scores1)
line.add_yaxis("小杰",scores2)
line.add_yaxis("皮皮",scores3)
line.set_global_opts(title_opts={"text":"成绩走势图","subtext":"高三数学"})
#保存到本地文件
line.render()
\ No newline at end of file
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
</head> </head>
<body> <body>
<div id="55f3c3f0e54742fead3fa353ab81154b" class="chart-container" style="width:900px; height:500px;"></div> <div id="c024c7bd09ff40d38311990220138a88" class="chart-container" style="width:900px; height:500px;"></div>
<script> <script>
var chart_55f3c3f0e54742fead3fa353ab81154b = echarts.init( var chart_c024c7bd09ff40d38311990220138a88 = echarts.init(
document.getElementById('55f3c3f0e54742fead3fa353ab81154b'), 'white', {renderer: 'canvas'}); document.getElementById('c024c7bd09ff40d38311990220138a88'), 'white', {renderer: 'canvas'});
var option_55f3c3f0e54742fead3fa353ab81154b = { var option_c024c7bd09ff40d38311990220138a88 = {
"animation": true, "animation": true,
"animationThreshold": 2000, "animationThreshold": 2000,
"animationDuration": 1000, "animationDuration": 1000,
...@@ -48,72 +48,233 @@ ...@@ -48,72 +48,233 @@
], ],
"series": [ "series": [
{ {
"type": "bar", "type": "line",
"name": "\u671f\u4e2d\u6210\u7ee9", "name": "\u806a\u806a",
"legendHoverLink": true, "connectNulls": false,
"symbolSize": 4,
"showSymbol": true,
"smooth": false,
"clip": true,
"step": false,
"data": [ "data": [
150, [
95, "\u7b2c1\u6b21",
82, 112
88 ],
[
"\u7b2c2\u6b21",
110
],
[
"\u7b2c3\u6b21",
118
],
[
"\u7b2c4\u6b21",
124
],
[
"\u7b2c5\u6b21",
129
],
[
"\u7b2c6\u6b21",
132
],
[
"\u7b2c7\u6b21",
136
],
[
"\u7b2c8\u6b21",
139
],
[
"\u7b2c9\u6b21",
134
],
[
"\u7b2c10\u6b21",
143
]
], ],
"showBackground": false, "hoverAnimation": true,
"barWidth": 40,
"barMinHeight": 0,
"barCategoryGap": "20%",
"barGap": "30%",
"large": false,
"largeThreshold": 400,
"seriesLayoutBy": "column",
"datasetIndex": 0,
"clip": true,
"zlevel": 0,
"z": 2,
"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": "\u5c0f\u6770",
"legendHoverLink": true, "connectNulls": false,
"symbolSize": 4,
"showSymbol": true,
"smooth": false,
"clip": true,
"step": false,
"data": [ "data": [
95, [
79, "\u7b2c1\u6b21",
93, 128
90 ],
[
"\u7b2c2\u6b21",
131
],
[
"\u7b2c3\u6b21",
132
],
[
"\u7b2c4\u6b21",
139
],
[
"\u7b2c5\u6b21",
130
],
[
"\u7b2c6\u6b21",
127
],
[
"\u7b2c7\u6b21",
129
],
[
"\u7b2c8\u6b21",
131
],
[
"\u7b2c9\u6b21",
132
],
[
"\u7b2c10\u6b21",
128
]
], ],
"showBackground": false, "hoverAnimation": true,
"barWidth": 40, "label": {
"barMinHeight": 0, "show": true,
"barCategoryGap": "20%", "position": "top",
"barGap": "30%", "margin": 8
"large": false, },
"largeThreshold": 400, "lineStyle": {
"seriesLayoutBy": "column", "show": true,
"datasetIndex": 0, "width": 1,
"clip": true, "opacity": 1,
"curveness": 0,
"type": "solid"
},
"areaStyle": {
"opacity": 0
},
"zlevel": 0, "zlevel": 0,
"z": 2, "z": 0
},
{
"type": "line",
"name": "\u76ae\u76ae",
"connectNulls": false,
"symbolSize": 4,
"showSymbol": true,
"smooth": false,
"clip": true,
"step": false,
"data": [
[
"\u7b2c1\u6b21",
143
],
[
"\u7b2c2\u6b21",
145
],
[
"\u7b2c3\u6b21",
140
],
[
"\u7b2c4\u6b21",
133
],
[
"\u7b2c5\u6b21",
134
],
[
"\u7b2c6\u6b21",
126
],
[
"\u7b2c7\u6b21",
121
],
[
"\u7b2c8\u6b21",
120
],
[
"\u7b2c9\u6b21",
114
],
[
"\u7b2c10\u6b21",
105
]
],
"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", "\u806a\u806a",
"\u671f\u672b\u6210\u7ee9" "\u5c0f\u6770",
"\u76ae\u76ae"
], ],
"selected": { "selected": {
"\u671f\u4e2d\u6210\u7ee9": true, "\u806a\u806a": true,
"\u671f\u672b\u6210\u7ee9": true "\u5c0f\u6770": true,
} "\u76ae\u76ae": true
},
"show": true,
"padding": 5,
"itemGap": 10,
"itemWidth": 25,
"itemHeight": 14
} }
], ],
"tooltip": { "tooltip": {
...@@ -155,10 +316,16 @@ ...@@ -155,10 +316,16 @@
} }
}, },
"data": [ "data": [
"\u6d48\u6d48", "\u7b2c1\u6b21",
"\u806a\u806a", "\u7b2c2\u6b21",
"\u5c0f\u667a", "\u7b2c3\u6b21",
"\u6ce2\u5947" "\u7b2c4\u6b21",
"\u7b2c5\u6b21",
"\u7b2c6\u6b21",
"\u7b2c7\u6b21",
"\u7b2c8\u6b21",
"\u7b2c9\u6b21",
"\u7b2c10\u6b21"
] ]
} }
], ],
...@@ -184,9 +351,13 @@ ...@@ -184,9 +351,13 @@
} }
} }
} }
] ],
"title": {
"text": "\u6210\u7ee9\u8d70\u52bf\u56fe",
"subtext": "\u9ad8\u4e09\u6570\u5b66"
}
}; };
chart_55f3c3f0e54742fead3fa353ab81154b.setOption(option_55f3c3f0e54742fead3fa353ab81154b); chart_c024c7bd09ff40d38311990220138a88.setOption(option_c024c7bd09ff40d38311990220138a88);
</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