Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
svg_chart
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王亚楠
svg_chart
Commits
999323fd
Commit
999323fd
authored
Aug 24, 2021
by
晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
柱状图
parent
59c99053
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
241 additions
and
111 deletions
+241
-111
chart/chart.css
chart/chart.css
+13
-13
chart/chart.js
chart/chart.js
+153
-88
chart/chart.md
chart/chart.md
+9
-0
demo.html
demo.html
+66
-10
No files found.
chart/chart.css
View file @
999323fd
...
...
@@ -6,17 +6,17 @@ body {
margin
:
0px
;
}
#
global-svg
{
.
global-svg
{
background-color
:
#ffffff
;
/* max-width: 1000px; */
/* border: 1px solid red; */
}
#
global-svg
.path-g-container
{
.
global-svg
.path-g-container
{
--stroke-length
:
0
;
}
#
global-svg
.line
{
.
global-svg
.line
{
stroke-dasharray
:
var
(
--stroke-length
);
stroke-dashoffset
:
var
(
--stroke-length
);
/* animation-delay: .3s; */
...
...
@@ -53,18 +53,18 @@ body {
}
}
#
global-svg
.line-1
{
.
global-svg
.line-1
{
/* fill: transparent; */
}
#
global-svg
.animate
.line
{
.
global-svg.animate
.line
{
animation
:
3s
animate-line
linear
;
animation-fill-mode
:
forwards
;
}
#
global-svg
.animate
.line-1
{
.
global-svg.animate
.line-1
{
/* animation: 3s animate-line-bg linear;
animation-fill-mode: forwards; */
}
...
...
@@ -93,12 +93,12 @@ body {
}
/* 圆点动画 */
#
global-svg
.point
{
.
global-svg
.point
{
opacity
:
0
;
position
:
relative
;
}
#
global-svg
.point
::after
{
.
global-svg
.point
::after
{
content
:
''
;
position
:
absolute
;
width
:
18px
;
...
...
@@ -106,18 +106,18 @@ body {
/* background-color: red; */
}
#
global-svg
.animate
.point
{
.
global-svg.animate
.point
{
animation
:
.5s
fade-in
ease-in-out
,
.5s
zoom-in
ease-in-out
;
animation-fill-mode
:
forwards
;
animation-delay
:
var
(
--delay
);
}
/* 数值动画 */
#
global-svg
.value-text
{
.
global-svg
.value-text
{
opacity
:
0
;
}
#
global-svg
.animate
.value-text
{
.
global-svg.animate
.value-text
{
animation
:
.5s
fade-in
ease-in-out
;
animation-fill-mode
:
forwards
;
animation-delay
:
var
(
--delay
);
...
...
@@ -130,10 +130,10 @@ body {
transition
:
.25s
opacity
ease-in-outl
}
#
global-svg
.animate
.loading
{
.
global-svg.animate
.loading
{
opacity
:
0
;
}
#
global-svg
.hover-circle
,
.hover-line
{
.
global-svg
.hover-circle
,
.hover-line
{
opacity
:
0
;
}
chart/chart.js
View file @
999323fd
This diff is collapsed.
Click to expand it.
chart/chart.md
View file @
999323fd
...
...
@@ -96,6 +96,15 @@
circlestroke
:
'
#87CEFA
'
,
linestroke
:
'
#f6f6f6
'
}
},
{
type
:
'
bar
'
,
// bar: 柱状图
data
:
[
0.75
,
0.1
,
0.7
,
1
,
0.26
,
0.3
,
0.9
],
normalStyle
:
{
// 柱状图常规样式
backgroundColor
:
'
#953C96
'
,
// 柱状图颜色
width
:
14
,
// 柱状宽度
borderRadius
:
3
// 柱状圆角
},
}
]
}
...
...
line_
demo.html
→
demo.html
View file @
999323fd
...
...
@@ -2,13 +2,18 @@
<html
lang=
"en"
dir=
"ltr"
>
<head>
<meta
charset=
"utf-8"
>
<title>
折线
demo
</title>
<title>
demo
</title>
<link
rel=
"stylesheet"
href=
"./chart/chart.css"
>
</head>
<body>
<!-- 折线图 -->
<div
style =
'width:100%;height:400px;'
>
<div
id =
'tongchart'
width =
'425'
height =
'236'
></div>
<!-- <div id = 'tongchart' width = '425' height = '236' style = 'width:425px;height:236px;'></div> -->
<div
id =
'tongline'
width =
'425'
height =
'236'
></div>
</div>
<!-- 柱状图 -->
<div
style =
'width:100%;height:400px;margin-top:100px;'
>
<div
id =
'tongbar'
width =
'425'
height =
'236'
></div>
</div>
</body>
...
...
@@ -17,7 +22,7 @@
let
_width
=
document
.
body
.
clientWidth
;
console
.
log
(
_width
,
'
----
'
);
// document.querySelector('#tongchart').setAttribute('width', _width);
var
myChart
=
chart
.
init
(
document
.
getElementById
(
'
tong
chart
'
));
var
myChart
=
chart
.
init
(
document
.
getElementById
(
'
tong
line
'
));
var
option
=
{
animateTime
:
3
,
xAxis
:
{
...
...
@@ -61,20 +66,71 @@
{
type
:
'
line
'
,
smooth
:
true
,
// 是否是平滑曲线
data
:
[
0.
8
,
0.1
,
0.7
,
1
,
0.26
,
0.3
,
0.9
],
data
:
[
0.
75
,
0.1
,
0.7
,
1
,
0.26
,
0.3
,
0.9
],
normalStyle
:
{
linestroke
:
'
#
2A9BC5
'
,
circlestroke
:
'
#
2A9BC5
'
,
pathBgColor
:
'
#
2A9BC5
'
linestroke
:
'
#
87CEFA
'
,
circlestroke
:
'
#
87CEFA
'
,
pathBgColor
:
'
#
87CEFA
'
,
},
hoverStyle
:
{
circlestroke
:
'
#87CEFA
'
,
linestroke
:
'
#f6f6f6
'
}
}
}
,
]
}
// 使用刚指定的配置项和数据显示图表。
myChart
.
setOption
(
option
);
myChart
.
setOption
(
option
,
'
tongline
'
);
// 设置柱状图
var
myChartBar
=
chart
.
init
(
document
.
getElementById
(
'
tongbar
'
));
var
optionbar
=
{
animateTime
:
3
,
xAxis
:
{
data
:
[
'
Mon
'
,
'
Tue
'
,
'
Wed
'
,
'
Thu
'
,
'
Fri
'
,
'
Sat
'
,
'
Sun
'
],
font
:
{
fontSize
:
12
,
color
:
'
rgba(40,40,40,0.3)
'
,
hoverFontColor
:
'
rgba(40,40,40,1)
'
},
outpadding
:
10
,
inpadding
:
10
,
},
yAxis
:
{
font
:
{
fontSize
:
12
,
color
:
'
rgba(40,40,40,0.3)
'
},
yLineColor
:
'
#F6F6F6
'
,
// '#F6F6F6',
min
:
0
,
max
:
1
,
totalLine
:
5
,
padding
:
15
},
series
:
[
{
type
:
'
bar
'
,
data
:
[
0.75
,
0.1
,
0.7
,
1
,
0.26
,
0.3
,
0.9
],
normalStyle
:
{
backgroundColor
:
'
#2A9BC5
'
,
width
:
14
,
borderRadius
:
3
},
},
{
type
:
'
bar
'
,
data
:
[
0.75
,
0.1
,
0.7
,
1
,
0.26
,
0.3
,
0.9
],
normalStyle
:
{
backgroundColor
:
'
#953C96
'
,
width
:
14
,
borderRadius
:
3
},
}
]
}
myChartBar
.
setOption
(
optionbar
,
'
tongbar
'
);
</script>
</html>
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