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
119422f8
Commit
119422f8
authored
Jan 13, 2022
by
何钱贝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:饼图
parent
ee656d42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
8 deletions
+75
-8
NormalGauge.vue
components/NormalGauge/NormalGauge.vue
+1
-1
NormalPie.vue
components/NormalPie/NormalPie.vue
+74
-7
No files found.
components/NormalGauge/NormalGauge.vue
View file @
119422f8
...
...
@@ -26,7 +26,7 @@ export default {
lazyLoad
:
true
}
};
}
}
,
onReady
()
{
...
...
components/NormalPie/NormalPie.vue
View file @
119422f8
<
template
>
<view>
<uni-ec-canvas
class=
"uni-ec-canvas"
id=
"NormalPie"
ref=
"canvas"
canvas-id=
"lazy-load-chart"
:ec=
"ec"
></uni-ec-canvas>
</view>
</
template
>
<
script
>
export
default
{
name
:
"NormalPie"
,
data
()
{
return
{
};
import
uniEcCanvas
from
'@/components/uni-ec-canvas/uni-ec-canvas'
import
*
as
echarts
from
'@/components/uni-ec-canvas/echarts'
import
echartElementData
from
'@/mixins/echartElementData.js'
let
chart
=
null
export
default
{
name
:
"NormalPie"
,
mixins
:
[
echartElementData
],
data
()
{
return
{
ec
:
{
lazyLoad
:
true
}
};
},
onReady
()
{
},
components
:
{
uniEcCanvas
},
methods
:
{
initChart
()
{
this
.
$nextTick
(()
=>
{
this
.
$refs
[
'canvas'
].
init
((
canvas
,
width
,
height
,
canvasDpr
)
=>
{
chart
=
echarts
.
init
(
canvas
,
null
,
{
width
:
width
,
height
:
height
,
devicePixelRatio
:
canvasDpr
})
canvas
.
setChart
(
chart
)
const
{
dataList
:
{
categories
,
series
}
}
=
this
.
elementData
const
options
=
{
...
this
.
elementInfo
.
option
,
color
:
[
'#1089E7'
,
'#F57474'
,
'#56D0E3'
,
'#F8B448'
,
'#8B78F6'
],
tooltip
:
{
trigger
:
'item'
,
formatter
:
'{a}<br/>{b}:{c}({d}%)'
},
series
:
this
.
dealSeriesData
(
series
)
}
chart
.
setOption
(
options
)
return
chart
})
})
},
dealSeriesData
(
data
)
{
if
(
!
data
)
return
const
series
=
[{
type
:
'pie'
,
center
:
[
"50%"
,
"50%"
],
...
props
.
elementInfo
.
option
.
pie
,
label
:
{
...
props
.
elementInfo
.
option
.
dataset
},
labelLine
:
{
show
:
true
},
data
}]
return
series
}
}
}
</
script
>
<
style
>
...
...
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