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
fba69cd3
Commit
fba69cd3
authored
May 12, 2022
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:fix datazoom drag to change label show
parent
669cdf4f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
56 deletions
+119
-56
DashboardProgress.vue
components/DashboardProgress/DashboardProgress.vue
+0
-1
HorizontalBar.vue
components/HorizontalBar/HorizontalBar.vue
+29
-12
LineMixBar.vue
components/LineMixBar/LineMixBar.vue
+28
-12
NormalBar.vue
components/NormalBar/NormalBar.vue
+28
-11
NormalLine.vue
components/NormalLine/NormalLine.vue
+34
-17
details.vue
pages/details/details.vue
+0
-3
No files found.
components/DashboardProgress/DashboardProgress.vue
View file @
fba69cd3
...
@@ -36,7 +36,6 @@
...
@@ -36,7 +36,6 @@
inited
(
canvas
,
width
,
height
,
canvasDpr
)
{
inited
(
canvas
,
width
,
height
,
canvasDpr
)
{
var
scale
=
1.0
var
scale
=
1.0
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
()
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
()
console
.
log
(
'window width is : '
,
windowWidth
)
if
(
windowWidth
<
400
)
{
if
(
windowWidth
<
400
)
{
scale
=
1.25
scale
=
1.25
}
}
...
...
components/HorizontalBar/HorizontalBar.vue
View file @
fba69cd3
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
import
echartElementData
from
'@/mixins/echartElementData.js'
import
echartElementData
from
'@/mixins/echartElementData.js'
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
let
chart
=
null
let
chart
=
null
let
lastCount
=
0
// 记录datazoom最后一次滑动的数值数量
export
default
{
export
default
{
name
:
"HorizontalBar"
,
name
:
"HorizontalBar"
,
...
@@ -99,6 +100,7 @@
...
@@ -99,6 +100,7 @@
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
this
.
elementInfo
.
option
.
dataset
.
show
=
false
this
.
elementInfo
.
option
.
dataset
.
show
=
false
}
}
lastCount
=
count
}
}
const
dealSeries
=
this
.
dealSeriesData
(
series
)
const
dealSeries
=
this
.
dealSeriesData
(
series
)
...
@@ -166,23 +168,38 @@
...
@@ -166,23 +168,38 @@
},
},
/**
/**
* 处理图表的数值是否显示
* 处理图表的数值是否显示
* 超过
10
个时隐藏点的数值
* 超过
maxCount
个时隐藏点的数值
* event: 包含dataZoom的start和end
* event: 包含dataZoom的start和end
*/
*/
dealLabelShowStatus
(
event
)
{
dealLabelShowStatus
(
event
)
{
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
if
(
this
.
labelShow
)
{
if
(
this
.
labelShow
)
{
var
flag
=
false
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
option
=
chart
.
getOption
()
const
maxCount
=
this
.
elementInfo
.
option
.
dataset
.
maxCount
if
(
lastCount
<
count
&&
lastCount
<=
maxCount
&&
count
>
maxCount
)
{
// 放大的情况
flag
=
true
}
if
(
lastCount
>
count
&&
lastCount
>=
maxCount
&&
count
<
maxCount
)
{
// 缩小的情况
flag
=
true
}
lastCount
=
count
if
(
flag
)
{
var
option
=
chart
.
getOption
()
// TODO:切换全屏后返回,chart实例不存在了
// TODO:切换全屏后返回,chart实例不存在了
if
(
!
option
)
{
if
(
!
option
)
{
// 这样处理没有效果
option
=
this
.
ec
.
option
return
return
}
}
const
series
=
option
.
series
const
series
=
option
.
series
series
.
map
(
item
=>
{
series
.
map
(
item
=>
{
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
})
})
chart
.
setOption
(
option
)
chart
.
setOption
({
series
:
series
})
}
}
}
}
}
}
}
...
...
components/LineMixBar/LineMixBar.vue
View file @
fba69cd3
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
svg
}
from
'@/mixins/svg.js'
import
{
svg
}
from
'@/mixins/svg.js'
let
chart
=
null
let
chart
=
null
let
lastCount
=
0
// 记录datazoom最后一次滑动的数值数量
export
default
{
export
default
{
name
:
"LineMixBar"
,
name
:
"LineMixBar"
,
...
@@ -107,6 +108,7 @@
...
@@ -107,6 +108,7 @@
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
this
.
elementInfo
.
option
.
dataset
.
show
=
false
this
.
elementInfo
.
option
.
dataset
.
show
=
false
}
}
lastCount
=
count
}
}
const
dealSeries
=
this
.
dealSeriesData
(
series
)
const
dealSeries
=
this
.
dealSeriesData
(
series
)
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
...
@@ -156,26 +158,40 @@
...
@@ -156,26 +158,40 @@
},
},
/**
/**
* 处理图表的数值是否显示
* 处理图表的数值是否显示
* 超过
10
个时隐藏点的数值
* 超过
maxCount
个时隐藏点的数值
* event: 包含dataZoom的start和end
* event: 包含dataZoom的start和end
*/
*/
dealLabelShowStatus
(
event
)
{
dealLabelShowStatus
(
event
)
{
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
if
(
this
.
labelShow
)
{
if
(
this
.
labelShow
)
{
var
flag
=
false
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
option
=
chart
.
getOption
()
const
maxCount
=
this
.
elementInfo
.
option
.
dataset
.
maxCount
if
(
lastCount
<
count
&&
lastCount
<=
maxCount
&&
count
>
maxCount
)
{
// 放大的情况
flag
=
true
}
if
(
lastCount
>
count
&&
lastCount
>=
maxCount
&&
count
<
maxCount
)
{
// 缩小的情况
flag
=
true
}
lastCount
=
count
if
(
flag
)
{
var
option
=
chart
.
getOption
()
// TODO:切换全屏后返回,chart实例不存在了
// TODO:切换全屏后返回,chart实例不存在了
if
(
!
option
)
{
if
(
!
option
)
{
// 这样处理没有效果
option
=
this
.
ec
.
option
return
return
}
}
const
series
=
option
.
series
const
series
=
option
.
series
series
.
map
(
item
=>
{
series
.
map
(
item
=>
{
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
})
})
chart
.
setOption
(
option
)
chart
.
setOption
({
series
:
series
})
}
}
}
}
}
}
}
}
}
</
script
>
</
script
>
...
...
components/NormalBar/NormalBar.vue
View file @
fba69cd3
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
svg
}
from
'@/mixins/svg.js'
import
{
svg
}
from
'@/mixins/svg.js'
let
chart
=
null
let
chart
=
null
let
lastCount
=
0
// 记录datazoom最后一次滑动的数值数量
export
default
{
export
default
{
name
:
"Normalbar"
,
name
:
"Normalbar"
,
...
@@ -93,6 +94,7 @@
...
@@ -93,6 +94,7 @@
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
this
.
elementInfo
.
option
.
dataset
.
show
=
false
this
.
elementInfo
.
option
.
dataset
.
show
=
false
}
}
lastCount
=
count
}
}
const
dealSeries
=
this
.
dealSeriesData
(
series
)
const
dealSeries
=
this
.
dealSeriesData
(
series
)
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
...
@@ -133,23 +135,38 @@
...
@@ -133,23 +135,38 @@
},
},
/**
/**
* 处理图表的数值是否显示
* 处理图表的数值是否显示
* 超过
10
个时隐藏点的数值
* 超过
maxCount
个时隐藏点的数值
* event: 包含dataZoom的start和end
* event: 包含dataZoom的start和end
*/
*/
dealLabelShowStatus
(
event
)
{
dealLabelShowStatus
(
event
)
{
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
if
(
this
.
labelShow
)
{
if
(
this
.
labelShow
)
{
var
flag
=
false
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
option
=
chart
.
getOption
()
const
maxCount
=
this
.
elementInfo
.
option
.
dataset
.
maxCount
if
(
lastCount
<
count
&&
lastCount
<=
maxCount
&&
count
>
maxCount
)
{
// 放大的情况
flag
=
true
}
if
(
lastCount
>
count
&&
lastCount
>=
maxCount
&&
count
<
maxCount
)
{
// 缩小的情况
flag
=
true
}
lastCount
=
count
if
(
flag
)
{
var
option
=
chart
.
getOption
()
// TODO:切换全屏后返回,chart实例不存在了
// TODO:切换全屏后返回,chart实例不存在了
if
(
!
option
)
{
if
(
!
option
)
{
// 这样处理没有效果
option
=
this
.
ec
.
option
return
return
}
}
const
series
=
option
.
series
const
series
=
option
.
series
series
.
map
(
item
=>
{
series
.
map
(
item
=>
{
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
})
})
chart
.
setOption
(
option
)
chart
.
setOption
({
series
:
series
})
}
}
}
}
}
}
}
...
...
components/NormalLine/NormalLine.vue
View file @
fba69cd3
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
DATAZOOM_DEFAULT
}
from
'@/mixins/zoomConfig.js'
import
{
svg
}
from
'@/mixins/svg.js'
import
{
svg
}
from
'@/mixins/svg.js'
let
chart
=
null
let
chart
=
null
let
lastCount
=
0
// 记录datazoom最后一次滑动的数值数量
export
default
{
export
default
{
mixins
:
[
echartElementData
],
mixins
:
[
echartElementData
],
...
@@ -18,7 +19,7 @@
...
@@ -18,7 +19,7 @@
lazyLoad
:
true
,
lazyLoad
:
true
,
option
:
{}
option
:
{}
},
},
labelShow
:
false
// 记录当前设置的label.show的值
labelShow
:
false
,
// 记录当前设置的label.show的值
}
}
},
},
components
:
{
components
:
{
...
@@ -88,23 +89,24 @@
...
@@ -88,23 +89,24 @@
const
{
categories
,
series
}
=
this
.
elementData
.
dataList
const
{
categories
,
series
}
=
this
.
elementData
.
dataList
if
(
this
.
labelShow
)
{
if
(
this
.
labelShow
)
{
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
let
count
=
categories
.
length
var
count
=
categories
.
length
if
(
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
)
{
if
(
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
)
{
count
=
count
*
(
this
.
elementInfo
.
dataZoom
.
end
-
this
.
elementInfo
.
dataZoom
.
start
)
/
100
count
=
count
*
(
this
.
elementInfo
.
dataZoom
.
end
-
this
.
elementInfo
.
dataZoom
.
start
)
/
100
}
}
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
if
(
count
>
this
.
elementInfo
.
option
.
dataset
.
maxCount
)
{
this
.
elementInfo
.
option
.
dataset
.
show
=
false
this
.
elementInfo
.
option
.
dataset
.
show
=
false
}
}
lastCount
=
count
}
}
const
dealSeries
=
this
.
dealSeriesData
(
series
)
const
dealSeries
=
this
.
dealSeriesData
(
series
)
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
this
.
$set
(
this
.
ec
.
option
,
'series'
,
dealSeries
)
this
.
$set
(
this
.
ec
.
option
,
'series'
,
dealSeries
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom'
,
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
?
[{...
this
.
elementInfo
.
dataZoom
,...
DATAZOOM_DEFAULT
}]
:
[{
show
:
false
}])
this
.
$set
(
this
.
ec
.
option
,
'dataZoom'
,
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
?
[{...
this
.
elementInfo
.
dataZoom
,...
DATAZOOM_DEFAULT
}]
:
[{
show
:
false
}])
if
(
chart
)
{
if
(
chart
)
{
const
option
=
chart
.
getOption
()
option
.
series
=
dealSeries
// 重新setOption,使得设置的formatter生效
// 重新setOption,使得设置的formatter生效
chart
.
setOption
(
option
)
chart
.
setOption
({
series
:
dealSeries
})
}
}
})
})
},
},
...
@@ -135,23 +137,38 @@
...
@@ -135,23 +137,38 @@
},
},
/**
/**
* 处理图表的数值是否显示
* 处理图表的数值是否显示
* 超过
10
个时隐藏点的数值
* 超过
maxCount
个时隐藏点的数值
* event: 包含dataZoom的start和end
* event: 包含dataZoom的start和end
*/
*/
dealLabelShowStatus
(
event
)
{
dealLabelShowStatus
(
event
)
{
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
// 当前图表初始设置了labelShow=true时,才判断超过10个隐藏
if
(
this
.
labelShow
)
{
if
(
this
.
labelShow
)
{
var
flag
=
false
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
count
=
this
.
elementData
.
dataList
.
categories
.
length
*
(
event
.
end
-
event
.
start
)
/
100
const
option
=
chart
.
getOption
()
const
maxCount
=
this
.
elementInfo
.
option
.
dataset
.
maxCount
if
(
lastCount
<
count
&&
lastCount
<=
maxCount
&&
count
>
maxCount
)
{
// 放大的情况
flag
=
true
}
if
(
lastCount
>
count
&&
lastCount
>=
maxCount
&&
count
<
maxCount
)
{
// 缩小的情况
flag
=
true
}
lastCount
=
count
if
(
flag
)
{
var
option
=
chart
.
getOption
()
// TODO:切换全屏后返回,chart实例不存在了
// TODO:切换全屏后返回,chart实例不存在了
if
(
!
option
)
{
if
(
!
option
)
{
// 这样处理没有效果
option
=
this
.
ec
.
option
return
return
}
}
const
series
=
option
.
series
const
series
=
option
.
series
series
.
map
(
item
=>
{
series
.
map
(
item
=>
{
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
item
.
label
.
show
=
count
<=
this
.
elementInfo
.
option
.
dataset
.
maxCount
})
})
chart
.
setOption
(
option
)
chart
.
setOption
({
series
:
series
})
}
}
}
}
}
}
}
...
...
pages/details/details.vue
View file @
fba69cd3
...
@@ -119,14 +119,11 @@
...
@@ -119,14 +119,11 @@
uni
.
$on
(
'handleDataZoomParams'
,
({
index
,
paramName
,
value
})
=>
{
uni
.
$on
(
'handleDataZoomParams'
,
({
index
,
paramName
,
value
})
=>
{
if
(
index
.
length
&&
paramName
&&
value
)
{
if
(
index
.
length
&&
paramName
&&
value
)
{
that
.
reportInfo
.
list
=
that
.
reportInfo
.
list
.
map
(
item
=>
{
that
.
reportInfo
.
list
=
that
.
reportInfo
.
list
.
map
(
item
=>
{
console
.
log
(
'begin item'
,
item
)
const
flag
=
index
.
includes
(
item
.
id
)
const
flag
=
index
.
includes
(
item
.
id
)
if
(
flag
&&
item
.
dataZoom
)
{
if
(
flag
&&
item
.
dataZoom
)
{
console
.
log
(
'set item'
,
item
)
that
.
$set
(
item
.
dataZoom
,
'start'
,
value
.
start
)
that
.
$set
(
item
.
dataZoom
,
'start'
,
value
.
start
)
that
.
$set
(
item
.
dataZoom
,
'end'
,
value
.
end
)
that
.
$set
(
item
.
dataZoom
,
'end'
,
value
.
end
)
}
}
console
.
log
(
'after item'
,
item
)
return
item
return
item
})
})
}
}
...
...
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