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
678be71b
Commit
678be71b
authored
Jan 17, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 地图混合柱状图 数据option
parent
8eb7e5b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
130 additions
and
5 deletions
+130
-5
BarMixMap.vue
components/BarMixMap/BarMixMap.vue
+130
-5
No files found.
components/BarMixMap/BarMixMap.vue
View file @
678be71b
<
template
>
<view>
柱状图混合地图
<uni-ec-canvas
class=
"uni-ec-canvas"
id=
"bar-mix-map"
...
...
@@ -23,9 +22,10 @@
mixins
:
[
echartElementData
],
data
()
{
return
{
ec
:
{
lazyLoad
:
true
}
ec
:
{
lazyLoad
:
true
},
changeTimer
:
null
}
},
components
:
{
...
...
@@ -34,9 +34,134 @@
methods
:
{
initChart
()
{
this
.
$nextTick
(()
=>
{
clearInterval
(
this
.
changeTimer
)
this
.
$refs
[
'barMixMapCanvas'
].
init
((
canvas
,
width
,
height
,
canvasDpr
)
=>
{
chart
=
echarts
.
init
(
canvas
,
null
,
{
width
:
width
,
height
:
height
,
devicePixelRatio
:
canvasDpr
})
canvas
.
setChart
(
chart
)
let
options
=
this
.
setMapOption
()
const
{
mapMixBarShow
,
mapMixBarChangeInterval
}
=
this
.
elementInfo
.
option
.
mapMix
let
flag
=
true
chart
.
setOption
(
options
,
true
)
// 柱状图 地图 切换
if
(
mapMixBarShow
&&
mapMixBarChangeInterval
)
{
clearInterval
(
this
.
changeTimer
)
this
.
changeTimer
=
setInterval
(()
=>
{
options
=
flag
?
this
.
setBarOption
()
:
this
.
setMapOption
()
flag
=
!
flag
chart
.
setOption
(
options
,
true
)
},
mapMixBarChangeInterval
*
1000
)
}
return
chart
})
})
},
setBarOption
()
{
const
{
dataList
:
{
series
}
}
=
this
.
elementData
let
options
=
{
...
this
.
elementInfo
.
option
,
tooltip
:
{},
yAxis
:
{
...
this
.
elementInfo
.
option
.
yAxis
,
data
:
this
.
dealSeriesData
(
series
).
categories
},
series
:
{
id
:
'associate'
,
type
:
'bar'
,
...
this
.
elementInfo
.
option
.
bar
,
label
:
{
...
this
.
elementInfo
.
option
.
dataset
,
formatter
:
(
val
)
=>
{
return
this
.
$u
.
common
.
converFunction
(
this
.
elementInfo
.
option
.
dataset
.
formatter
,
val
)
}
},
animationDurationUpdate
:
1000
,
universalTransition
:
true
,
data
:
this
.
dealSeriesData
(
series
).
series
}
}
return
options
},
setMapOption
()
{
const
{
dataList
}
=
this
.
elementData
const
seriesData
=
dataList
.
series
||
[]
const
series
=
[]
for
(
let
i
=
0
;
i
<
seriesData
.
length
;
i
++
)
{
const
geoCoord
=
geoCoordMapList
[
seriesData
[
i
].
name
]
if
(
geoCoord
)
{
series
.
push
({
name
:
seriesData
[
i
].
name
,
value
:
geoCoord
.
concat
(
seriesData
[
i
].
value
)
})
}
}
const
options
=
{
title
:
{
...
this
.
elementInfo
.
option
.
title
},
legend
:
{
...
this
.
elementInfo
.
option
.
legend
},
geo
:
{
map
:
'china'
,
zoom
:
1.2
,
roam
:
false
,
itemStyle
:
{
areaColor
:
'rgba(34, 70, 168, 0.7)'
,
borderColor
:
'#0692a4'
},
emphasis
:
{
itemStyle
:
{
areaColor
:
'rgba(119, 139, 224, 0.548)'
}
},
},
animationDurationUpdate
:
1000
,
series
:
[{
id
:
'associate'
,
type
:
'map'
,
map
:
'china'
,
geoIndex
:
0
,
aspectScale
:
0.75
,
animationDurationUpdate
:
1000
,
universalTransition
:
true
,
tooltip
:
{
show
:
false
},
data
:
series
,
},
{
type
:
'effectScatter'
,
coordinateSystem
:
'geo'
,
// zlevel: 2,
rippleEffect
:
{
brushType
:
'stroke'
},
label
:
{
show
:
true
,
position
:
'right'
,
formatter
:
(
value
)
=>
{
if
(
this
.
elementInfo
.
option
.
dataset
.
formatter
)
{
return
this
.
$u
.
common
.
converFunction
(
this
.
elementInfo
.
option
.
dataset
.
formatter
,
value
)
}
else
{
return
this
.
elementInfo
.
option
.
dataset
.
show
?
`
${
value
.
data
.
name
}
:
${
value
.
data
.
value
[
2
]}
`
:
value
.
data
.
name
}
},
fontSize
:
this
.
elementInfo
.
option
.
dataset
.
fontSize
,
color
:
this
.
elementInfo
.
option
.
dataset
.
color
,
fontWeight
:
this
.
elementInfo
.
option
.
dataset
.
fontWeight
},
symbolSize
:
6
,
itemStyle
:
{
color
:
'#a6c84c'
},
data
:
series
,
}]
}
return
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