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
9cdf8a62
Commit
9cdf8a62
authored
Jun 30, 2023
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add double yaxis
parent
c7f97eaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
4 deletions
+70
-4
NormalBar.vue
components/NormalBar/NormalBar.vue
+35
-2
NormalLine.vue
components/NormalLine/NormalLine.vue
+35
-2
No files found.
components/NormalBar/NormalBar.vue
View file @
9cdf8a62
...
...
@@ -49,13 +49,21 @@
if
(
that
.
elementInfo
.
option
.
colorConfig
&&
that
.
elementInfo
.
option
.
colorConfig
.
value
)
{
color
=
that
.
elementInfo
.
option
.
colorConfig
.
value
}
var
yAxis
=
that
.
dealYAxis
({...
that
.
elementInfo
.
option
.
yAxis
})
if
(
yAxis
.
showDouble
)
{
yAxis
=
[
that
.
dealYAxis
({
...
that
.
elementInfo
.
option
.
yAxis
}),
that
.
dealYAxis
({
...
that
.
elementInfo
.
option
.
yAxis
,
...
that
.
elementInfo
.
option
.
yAxis
.
second
})
]
}
that
.
ec
.
option
=
{
...
that
.
elementInfo
.
option
,
...
that
.
elementInfo
.
option
,
color
:
color
,
xAxis
:
{
...
that
.
elementInfo
.
option
.
xAxis
,
data
:
categories
},
},
yAxis
:
yAxis
,
tooltip
:
that
.
dealTooltip
(
that
.
elementInfo
.
option
.
tooltip
),
toolbox
:
{
...
that
.
elementInfo
.
option
.
toolbox
,
...
...
@@ -137,6 +145,27 @@
...
tooltip
,
trigger
:
"axis"
}
},
/**
*
* @param yAxis 表单的yAxis设置
*/
dealYAxis
(
yAxis
)
{
if
(
!
yAxis
)
{
return
}
if
(
yAxis
.
axisLabel
.
formatter
&&
yAxis
.
axisLabel
.
formatter
.
length
)
{
return
{
...
yAxis
,
axisLabel
:
{
...
yAxis
.
axisLabel
,
formatter
:
(
val
)
=>
{
return
this
.
$u
.
common
.
converFunction
(
yAxis
.
axisLabel
.
formatter
,
val
)
},
}
}
}
return
yAxis
},
/**
* 处理数据
...
...
@@ -156,6 +185,10 @@
}
}
}
if
(
that
.
elementInfo
.
option
.
yAxis
.
showDouble
)
{
const
yAxisIndex
=
data
.
length
-
1
===
index
?
1
:
0
return
{
...
item
,
...
config
,
yAxisIndex
:
yAxisIndex
}
}
return
{
...
item
,
...
config
...
...
components/NormalLine/NormalLine.vue
View file @
9cdf8a62
...
...
@@ -48,13 +48,21 @@
if
(
that
.
elementInfo
.
option
.
colorConfig
&&
that
.
elementInfo
.
option
.
colorConfig
.
value
)
{
color
=
that
.
elementInfo
.
option
.
colorConfig
.
value
}
var
yAxis
=
that
.
dealYAxis
({...
that
.
elementInfo
.
option
.
yAxis
})
if
(
yAxis
.
showDouble
)
{
yAxis
=
[
that
.
dealYAxis
({
...
that
.
elementInfo
.
option
.
yAxis
}),
that
.
dealYAxis
({
...
that
.
elementInfo
.
option
.
yAxis
,
...
that
.
elementInfo
.
option
.
yAxis
.
second
})
]
}
that
.
ec
.
option
=
{
...
that
.
elementInfo
.
option
,
color
:
color
,
xAxis
:
{
...
that
.
elementInfo
.
option
.
xAxis
,
data
:
categories
},
},
yAxis
:
yAxis
,
tooltip
:
that
.
dealTooltip
(
that
.
elementInfo
.
option
.
tooltip
),
toolbox
:
{
...
that
.
elementInfo
.
option
.
toolbox
,
...
...
@@ -137,13 +145,34 @@
trigger
:
"axis"
}
},
/**
*
* @param yAxis 表单的yAxis设置
*/
dealYAxis
(
yAxis
)
{
if
(
!
yAxis
)
{
return
}
if
(
yAxis
.
axisLabel
.
formatter
&&
yAxis
.
axisLabel
.
formatter
.
length
)
{
return
{
...
yAxis
,
axisLabel
:
{
...
yAxis
.
axisLabel
,
formatter
:
(
val
)
=>
{
return
this
.
$u
.
common
.
converFunction
(
yAxis
.
axisLabel
.
formatter
,
val
)
},
}
}
}
return
yAxis
},
/**
* 处理数据
*/
dealSeriesData
(
data
)
{
if
(
!
data
)
return
[]
const
that
=
this
const
newData
=
data
.
map
(
item
=>
{
const
newData
=
data
.
map
(
(
item
,
index
)
=>
{
const
config
=
{
type
:
'line'
,
...
that
.
elementInfo
.
option
.
line
,
...
...
@@ -155,6 +184,10 @@
},
}
}
if
(
that
.
elementInfo
.
option
.
yAxis
.
showDouble
)
{
const
yAxisIndex
=
data
.
length
-
1
===
index
?
1
:
0
return
{
...
item
,
...
config
,
yAxisIndex
:
yAxisIndex
}
}
return
{
...
item
,
...
config
...
...
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