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
a2a6456b
Commit
a2a6456b
authored
May 25, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 横向柱状图根据数据动态 resize
parent
9dc543b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
HorizontalBar.vue
components/HorizontalBar/HorizontalBar.vue
+6
-1
index.vue
pages/index/index.vue
+7
-2
No files found.
components/HorizontalBar/HorizontalBar.vue
View file @
a2a6456b
...
...
@@ -6,7 +6,7 @@
<
script
>
import
uniEcCanvas
from
'@/uni-ec-canvas/uni-ec-canvas'
import
echartElementData
from
'@/mixins/echartElementData.js'
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
let
chart
=
null
let
lastCount
=
0
// 记录datazoom最后一次滑动的数值数量
...
...
@@ -115,6 +115,11 @@
option
.
series
=
dealSeries
// 重新setOption,使得设置的formatter生效
chart
.
setOption
(
option
)
if
(
Number
(
dealSeries
[
0
].
barWidth
))
{
const
height
=
categories
.
length
*
(
Number
(
dealSeries
[
0
].
barWidth
)
+
5
)
+
25
uni
.
$emit
(
'handleUpdateHeight'
,
height
)
chart
.
resize
({
width
:
chart
.
getWidth
(),
height
})
}
}
if
(
preview
)
{
this
.
cacheImages
(
images
)
...
...
pages/index/index.vue
View file @
a2a6456b
...
...
@@ -12,7 +12,7 @@
]"
:style=
"
{
width: `${parseInt(element.width * scale)}px`,
height: `${parseInt(element.height * scale)}px`,
height: `${
element.type == 'HorizontalBar'
&&
horizontalBarHeight ? horizontalBarHeight :
parseInt(element.height * scale)}px`,
left: `${parseInt(element.left * scale)}px`,
top: `${parseInt(element.top * scale)}px`,
zIndex: `${element.type == 'NormalTabs' || element.type == 'DateTimePicker' ? 999999 : index + 1}`
...
...
@@ -69,7 +69,8 @@
reportInfo
:
{},
timename
:
null
,
pageScrollTop
:
0
,
stickyTables
:
[]
// 设置了吸顶的table
stickyTables
:
[],
// 设置了吸顶的table
horizontalBarHeight
:
0
}
},
computed
:
{
...
...
@@ -138,12 +139,16 @@
})
}
})
uni
.
$on
(
'handleUpdateHeight'
,
(
height
)
=>
{
that
.
horizontalBarHeight
=
height
})
},
onHide
()
{
// 移除监听事件
uni
.
$off
(
'handleLinkParams'
)
uni
.
$off
(
'handleLinkComp'
)
uni
.
$off
(
'handleDataZoomParams'
)
uni
.
$off
(
'handleUpdateHeight'
)
clearInterval
(
this
.
timename
)
},
methods
:
{
...
...
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