Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson24-diy1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
296a2ab4
authored
Dec 24, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
0b12f243
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
30 deletions
analysis.html
my_analysis.py
analysis.html
View file @
296a2ab4
...
...
@@ -7,11 +7,11 @@
</head>
<body>
<div
id=
"
da954c8b638842c08d8be257eb4fc00a
"
class=
"chart-container"
style=
"width:900px; height:500px;"
></div>
<div
id=
"
ed849ff026fb4b9781f847a65fb85cb1
"
class=
"chart-container"
style=
"width:900px; height:500px;"
></div>
<script>
var
chart_
da954c8b638842c08d8be257eb4fc00a
=
echarts
.
init
(
document
.
getElementById
(
'
da954c8b638842c08d8be257eb4fc00a
'
),
'white'
,
{
renderer
:
'canvas'
});
var
option_
da954c8b638842c08d8be257eb4fc00a
=
{
var
chart_
ed849ff026fb4b9781f847a65fb85cb1
=
echarts
.
init
(
document
.
getElementById
(
'
ed849ff026fb4b9781f847a65fb85cb1
'
),
'white'
,
{
renderer
:
'canvas'
});
var
option_
ed849ff026fb4b9781f847a65fb85cb1
=
{
"animation"
:
true
,
"animationThreshold"
:
2000
,
"animationDuration"
:
1000
,
...
...
@@ -49,20 +49,44 @@
"series"
:
[
{
"type"
:
"bar"
,
"name"
:
"\u6
d48\u6d48\u7684\u6210\u7ee9
"
,
"name"
:
"\u6
71f\u4e2d
"
,
"legendHoverLink"
:
true
,
"data"
:
[
88
,
92
,
95
,
96
,
94
,
62
,
66
,
64
,
82
,
88
],
"showBackground"
:
false
,
"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"
,
"legendHoverLink"
:
true
,
"data"
:
[
95
,
79
,
93
,
89
90
],
"showBackground"
:
false
,
"barWidth"
:
40
,
"barMinHeight"
:
0
,
"barCategoryGap"
:
"20%"
,
"barGap"
:
"30%"
,
...
...
@@ -83,10 +107,12 @@
"legend"
:
[
{
"data"
:
[
"\u6d48\u6d48\u7684\u6210\u7ee9"
"\u671f\u4e2d"
,
"\u671f\u672b"
],
"selected"
:
{
"\u6d48\u6d48\u7684\u6210\u7ee9"
:
true
"\u671f\u4e2d"
:
true
,
"\u671f\u672b"
:
true
}
}
],
...
...
@@ -129,15 +155,10 @@
}
},
"data"
:
[
"\u8bed\u6587"
,
"\u6570\u5b66"
,
"\u82f1\u8bed"
,
"\u5730\u7406"
,
"\u5386\u53f2"
,
"\u653f\u6cbb"
,
"\u751f\u7269"
,
"\u5316\u5b66"
,
"\u7269\u7406"
"\u6d48\u6d48"
,
"\u806a\u806a"
,
"\u5c0f\u667a"
,
"\u6ce2\u5947"
]
}
],
...
...
@@ -165,7 +186,7 @@
}
]
};
chart_
da954c8b638842c08d8be257eb4fc00a
.
setOption
(
option_da954c8b638842c08d8be257eb4fc00a
);
chart_
ed849ff026fb4b9781f847a65fb85cb1
.
setOption
(
option_ed849ff026fb4b9781f847a65fb85cb1
);
</script>
</body>
</html>
my_analysis.py
View file @
296a2ab4
from
pyecharts.charts
import
Bar
subjects
=
[
"语文"
,
"数学"
,
"英语"
,
"地理"
,
"历史"
,
"政治"
,
"生物"
,
"化学"
,
"物理"
]
scores
=
[
88
,
95
,
96
,
94
,
62
,
66
,
64
,
93
,
89
]
subjects
=
[
"浈浈"
,
"聪聪"
,
"小智"
,
"波奇"
]
scores1
=
[
92
,
95
,
82
,
88
]
scores2
=
[
95
,
79
,
93
,
90
]
# 创建
对应的图表
对象
bar
=
Bar
()
# 传入
x轴和y轴的数据
# 创建
柱状图
对象
bar
=
Bar
()
# 传入
数值
bar
.
add_xaxis
(
subjects
)
bar
.
add_yaxis
(
"浈浈的成绩"
,
scores
)
bar
.
add_yaxis
(
"期中"
,
scores1
,
bar_width
=
40
)
bar
.
add_yaxis
(
"期末"
,
scores2
,
bar_width
=
40
)
# 保存到本地文件
bar
.
render
(
"analysis.html"
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment