Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lihuizhen
ec-report-refactor
Commits
4a23926d
Commit
4a23926d
authored
Feb 25, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 仪表盘进度条重构
parent
fc407217
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
53 deletions
+50
-53
DashboardProgress.vue
components/DashboardProgress/DashboardProgress.vue
+50
-53
No files found.
components/DashboardProgress/DashboardProgress.vue
View file @
4a23926d
...
@@ -43,72 +43,70 @@
...
@@ -43,72 +43,70 @@
devicePixelRatio
:
canvasDpr
devicePixelRatio
:
canvasDpr
})
})
canvas
.
setChart
(
chart
)
canvas
.
setChart
(
chart
)
const
{
endVal
}
=
this
.
elementData
.
dataList
const
{
width
:
pCanvasWidth
,
strokeColor
,
trailColor
,
titleColor
,
strokeWidth
,
gapPosition
,
gapDegree
,
strokeLinecap
}
=
this
.
elementInfo
.
option
.
progress
const
guageChart
=
[{
const
guageChart
=
[{
name
:
""
,
name
:
""
,
value
:
this
.
elementData
.
dataList
.
endVal
value
:
endVal
}]
}]
const
color
=
[
const
color
=
[
[
this
.
elementData
.
dataList
.
endVal
/
100
,
this
.
elementInfo
.
option
.
progress
[
endVal
/
100
,
strokeColor
],
.
strokeColor
[
1
,
trailColor
]
],
[
1
,
this
.
elementInfo
.
option
.
progress
.
trailColor
]
]
]
const
strokeWidth
=
this
.
$u
.
common
.
pxToRpx
(
this
.
elementInfo
.
option
.
progress
.
strokeWidth
)
var
startAngle
=
180
var
startAngle
=
18
0
var
endAngle
=
0
var
endAngle
=
0
switch
(
gapPosition
)
{
switch
(
this
.
elementInfo
.
option
.
progress
.
gapPosition
)
{
case
'bottom'
:
case
'bottom'
:
if
(
gapDegree
>
180
)
{
if
(
this
.
elementInfo
.
option
.
progress
.
gapDegree
>
180
)
{
startAngle
=
45
+
(
360
-
gapDegree
)
/
2
startAngle
=
90
+
(
360
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
)
/
2
endAngle
=
135
-
(
360
-
gapDegree
)
/
2
endAngle
=
90
-
(
360
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
)
/
2
}
else
{
}
else
{
startAngle
=
225
-
gapDegree
/
2
startAngle
=
270
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
endAngle
=
45
-
(
90
-
gapDegree
/
2
)
endAngle
=
0
-
(
90
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
)
}
}
break
;
break
;
case
'top'
:
case
'top'
:
if
(
gapDegree
>
180
)
{
if
(
this
.
elementInfo
.
option
.
progress
.
gapDegree
>
180
)
{
startAngle
=
225
+
(
360
-
gapDegree
)
/
2
startAngle
=
270
+
(
360
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
)
/
2
endAngle
=
315
-
(
360
-
gapDegree
)
/
2
endAngle
=
270
-
(
360
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
)
/
2
}
else
{
}
else
{
startAngle
=
315
+
(
90
-
gapDegree
/
2
)
startAngle
=
360
+
(
90
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
)
endAngle
=
135
+
(
gapDegree
/
2
)
endAngle
=
90
+
(
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
)
}
}
break
;
break
;
case
'left'
:
case
'left'
:
if
(
gapDegree
>
180
)
{
if
(
this
.
elementInfo
.
option
.
progress
.
gapDegree
>
180
)
{
startAngle
=
-
45
+
(
360
-
gapDegree
)
/
2
startAngle
=
0
+
(
360
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
)
/
2
endAngle
=
45
-
(
360
-
gapDegree
)
/
2
endAngle
=
0
-
(
360
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
)
/
2
}
else
{
}
else
{
startAngle
=
135
-
gapDegree
/
2
startAngle
=
180
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
endAngle
=
-
135
+
gapDegree
/
2
endAngle
=
-
180
+
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
}
}
break
;
break
;
default
:
default
:
startAngle
=
315
-
gapDegree
/
2
startAngle
=
360
-
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
endAngle
=
45
+
gapDegree
/
2
endAngle
=
0
+
this
.
elementInfo
.
option
.
progress
.
gapDegree
/
2
break
;
break
;
}
}
const
axisLineWidth
=
strokeWidth
/
100
*
pCanvasWidth
const
options
=
{
const
options
=
{
...
this
.
elementInfo
.
option
,
...
this
.
elementInfo
.
option
,
tooltip
:
{
tooltip
:
{
formatter
:
'{a} <br/>{b} : {c}%'
formatter
:
'{a} <br/>{b} : {c}%'
},
},
title
:
[{
title
:
[{
text
:
this
.
elementData
.
dataList
.
endVal
+
'%'
,
text
:
endVal
+
'%'
,
x
:
'center'
,
x
:
'center'
,
top
:
'
45%
'
,
top
:
'
middle
'
,
textStyle
:
{
textStyle
:
{
fontSize
:
30
,
fontSize
:
Math
.
max
(
14
*
pCanvasWidth
/
132
,
14
)
,
color
:
t
his
.
elementInfo
.
option
.
progress
.
t
itleColor
,
color
:
titleColor
,
},
},
}],
}],
series
:
[{
series
:
[{
type
:
'gauge'
,
type
:
'gauge'
,
// center: ['50%', '50%'],
startAngle
:
startAngle
+
25
,
radius
:
'50%'
,
endAngle
:
endAngle
-
25
,
startAngle
:
startAngle
,
endAngle
:
endAngle
,
pointer
:
{
pointer
:
{
show
:
false
,
show
:
false
,
},
},
...
@@ -116,12 +114,12 @@
...
@@ -116,12 +114,12 @@
show
:
true
,
show
:
true
,
lineStyle
:
{
lineStyle
:
{
color
:
color
,
color
:
color
,
width
:
strok
eWidth
,
width
:
axisLin
eWidth
,
shadowOffsetX
:
0
,
shadowOffsetX
:
0
,
shadowOffsetY
:
0
,
shadowOffsetY
:
0
,
opacity
:
1
,
opacity
:
1
,
},
},
roundCap
:
this
.
elementInfo
.
option
.
progress
.
strokeLinecap
==
'round'
?
true
:
false
roundCap
:
strokeLinecap
==
'round'
?
true
:
false
},
},
splitLine
:
{
splitLine
:
{
show
:
false
show
:
false
...
@@ -132,8 +130,7 @@
...
@@ -132,8 +130,7 @@
axisTick
:
{
axisTick
:
{
show
:
false
show
:
false
},
},
radius
:
pCanvasWidth
/
2
-
strokeWidth
*
2
,
radius
:
'90%'
,
}]
}]
}
}
chart
.
setOption
(
options
)
chart
.
setOption
(
options
)
...
...
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