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
6d35d9c3
Commit
6d35d9c3
authored
Jan 11, 2022
by
chris.yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:折柱图
parent
48812baa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
LineMixBar.vue
components/LineMixBar/LineMixBar.vue
+112
-0
No files found.
components/LineMixBar/LineMixBar.vue
0 → 100644
View file @
6d35d9c3
<
template
>
<view>
<uni-ec-canvas
class=
"uni-ec-canvas"
id=
"line-chart"
ref=
"canvas"
canvas-id=
"lazy-load-chart"
:ec=
"ec"
>
</uni-ec-canvas>
</view>
</
template
>
<
script
>
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
:
"LineMixBar"
,
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
,
tooltip
:
{},
xAxis
:
{
...
this
.
elementInfo
.
option
.
xAxis
,
data
:
categories
},
yAxis
:
[{
...
this
.
elementInfo
.
option
.
yAxis
,
type
:
'value'
},
{
...
this
.
elementInfo
.
option
.
yAxis
,
type
:
'value'
}
],
series
:
this
.
dealSeriesData
(
series
)
}
chart
.
setOption
(
options
)
return
chart
})
})
},
/**
* 处理数据
*/
dealSeriesData
(
data
)
{
debugger
if
(
!
data
)
return
const
newData
=
data
.
map
(
item
=>
{
let
config
=
{
label
:
{
...
this
.
elementInfo
.
option
.
dataset
,
formatter
:
val
=>
{
return
converFunction
(
this
.
elementInfo
.
option
.
dataset
.
formatter
,
val
)
}
}
}
if
(
item
.
type
===
'bar'
)
{
config
=
{
...
config
,
...
this
.
elementInfo
.
option
.
bar
}
}
else
if
(
item
.
type
===
'line'
)
{
config
=
{
yAxisIndex
:
1
,
...
config
,
...
this
.
elementInfo
.
option
.
line
}
}
return
{
...
item
,
...
config
}
})
return
newData
}
}
}
</
script
>
<
style
scoped
>
.uni-ec-canvas
{
width
:
750
rpx
;
height
:
750
rpx
;
display
:
block
;
}
</
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