Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
gh
/
data-view
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 30135bb4
authored
Jun 24, 2022
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
折线图
1 parent
68889715
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
90 deletions
src/components/LineChart.vue → src/components/EchartLine.vue
src/components/lineOptions.js
src/views/afterSales/file.vue
src/components/
LineChart
.vue
→
src/components/
EchartLine
.vue
View file @
30135bb
<
template
>
<
template
>
<div
class=
"line-box"
>
<div
class=
"line-box"
>
<p
v-if=
"title"
class=
"title"
>
{{
title
}}
</p>
<div
id=
"echarts-line"
class=
"echarts-line"
></div>
<div
id=
"line-chart"
class=
"line-chart"
></div>
<div
class=
"rank-box"
>
<div
class=
"rank-box"
>
<div>
<div>
<p
:class=
"[ 'rank-title', rankFlag == 'first' ? 'rank-active' : '' ]"
@
click=
"handleRankChange('first')"
>
前5
{{
storeOrBrandTxt
}}
</p>
<p
:class=
"[ 'rank-title', rankFlag == 'first' ? 'rank-active' : '' ]"
@
click=
"handleRankChange('first')"
>
前5
{{
storeOrBrandTxt
}}
</p>
...
@@ -13,9 +12,9 @@
...
@@ -13,9 +12,9 @@
<
script
>
<
script
>
import
*
as
echarts
from
'echarts'
import
*
as
echarts
from
'echarts'
import
o
ptions
from
'./lineOptions'
import
getLineO
ptions
from
'./lineOptions'
export
default
{
export
default
{
name
:
'
LineChart
'
,
name
:
'
EchartLine
'
,
props
:
{
props
:
{
// height: {
// height: {
...
@@ -26,10 +25,6 @@ export default {
...
@@ -26,10 +25,6 @@ export default {
type
:
String
,
type
:
String
,
default
:
''
default
:
''
},
},
title
:
{
type
:
String
,
default
:
''
},
storeOrBrandTxt
:
{
storeOrBrandTxt
:
{
type
:
String
,
type
:
String
,
default
:
'门店'
default
:
'门店'
...
@@ -38,15 +33,25 @@ export default {
...
@@ -38,15 +33,25 @@ export default {
data
()
{
data
()
{
return
{
return
{
// first,last
rankFlag
:
'first'
,
rankFlag
:
'first'
,
lineOptions
:
JSON
.
parse
(
JSON
.
stringify
(
options
))
lineOptions
:
[],
xAxisLabel
:
{
monthList
:
[
'1月'
,
'2月'
,
'3月'
,
'4月'
,
'5月'
,
'6月'
,
'7月'
,
'8月'
,
'9月'
,
'10月'
,
'11月'
,
'12月'
]
},
echartsLine
:
''
,
dataList
:
[
1
,
2
,
3
,
10
,
5
,
2
,
7
,
8
,
9
,
10
,
11
,
12
],
moveAttr
:
{
speed
:
900
,
seriesIndex
:
0
,
dataIndex
:
-
1
},
timer
:
null
// chartHeight: this.height
// chartHeight: this.height
}
}
},
},
created
()
{
created
()
{
this
.
lineOptions
=
getLineOptions
({
axisLabelColor
:
this
.
axisLabelColor
})
},
},
mounted
()
{
mounted
()
{
...
@@ -54,10 +59,50 @@ export default {
...
@@ -54,10 +59,50 @@ export default {
},
},
methods
:
{
methods
:
{
dealxAxisLabel
()
{
this
.
lineOptions
.
xAxis
.
data
=
this
.
xAxisLabel
.
monthList
},
autoMove
()
{
clearTimeout
(
this
.
timer
)
this
.
timer
=
setTimeout
(()
=>
{
this
.
moveAttr
.
dataIndex
=
this
.
moveAttr
.
dataIndex
+
1
if
(
this
.
moveAttr
.
dataIndex
===
this
.
dataList
.
length
)
{
this
.
moveAttr
.
dataIndex
=
0
}
this
.
moveAction
()
this
.
autoMove
()
},
this
.
moveAttr
.
speed
)
},
chartBindEvent
()
{
this
.
echartsLine
.
on
(
'click'
,
()
=>
{
// clearTimeout(this.timer)
console
.
log
(
'???????'
)
})
},
moveAction
(
type
)
{
this
.
echartsLine
.
dispatchAction
({
type
:
type
||
'showTip'
,
seriesIndex
:
this
.
moveAttr
.
seriesIndex
,
dataIndex
:
this
.
moveAttr
.
dataIndex
})
},
drawLine
()
{
drawLine
()
{
var
lineDom
=
document
.
getElementById
(
'line-chart'
)
// var lineDom = document.getElementById('echarts-line')
var
lineChart
=
echarts
.
init
(
lineDom
)
// this.echartsLine = echarts.init(lineDom)
lineChart
.
setOption
(
this
.
lineOptions
)
this
.
echartsLine
=
echarts
.
init
(
document
.
getElementById
(
'echarts-line'
))
this
.
dealxAxisLabel
()
this
.
lineOptions
.
series
[
0
].
data
=
this
.
dataList
this
.
echartsLine
.
setOption
(
this
.
lineOptions
)
console
.
log
(
this
.
echartsLine
)
this
.
chartBindEvent
()
// this.autoMove()
},
},
handleRankChange
(
value
)
{
handleRankChange
(
value
)
{
...
@@ -73,25 +118,25 @@ p {
...
@@ -73,25 +118,25 @@ p {
}
}
.line-box
{
.line-box
{
color
:
#ffffff
;
color
:
#ffffff
;
padding
:
4px
8px
;
//
padding
:
4px
8px
;
font-size
:
0.75em
;
font-size
:
0.75em
;
.title
{
.echarts-line
{
height
:
17px
;
width
:
100%
;
color
:
#e8e8e8
;
height
:
calc
(
100%
-
3.1vh
-
4.6vh
);
}
.line-chart
{
height
:
calc
(
100%
-
25px
-
30px
);
}
}
.rank-box
{
.rank-box
{
box-sizing
:
border-box
;
display
:
flex
;
display
:
flex
;
height
:
30px
;
height
:
4.6vh
;
padding
:
0.48vh
0.87vh
;
border-top
:
1px
solid
#373739
;
.rank-title
{
.rank-title
{
box-sizing
:
border-box
;
box-sizing
:
border-box
;
font-size
:
0.6em
;
font-size
:
0.6em
;
background
:
#353535
;
background
:
#353535
;
padding
:
1px
5px
;
padding
:
1px
5px
;
height
:
1
5px
;
height
:
1
.83vh
;
line-height
:
1
5px
;
line-height
:
1
.83vh
;
opacity
:
0.7
;
opacity
:
0.7
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
...
...
src/components/lineOptions.js
View file @
30135bb
var
lineOptions
=
{
function
getLineOptions
(
obj
)
{
visualMap
:
[
// const { axisLabelColor } = obj
{
console
.
log
(
obj
)
show
:
false
,
var
lineOptions
=
{
type
:
'continuous'
,
tooltip
:
{
seriesIndex
:
0
,
trigger
:
'axis'
,
min
:
0
,
formatter
:
''
max
:
400
},
},
{
grid
:
{
show
:
false
,
left
:
'3%'
,
type
:
'continuous'
,
right
:
'4%'
,
seriesIndex
:
1
,
top
:
'10%'
,
dimension
:
0
,
bottom
:
'10%'
,
min
:
0
,
containLabel
:
true
max
:
0
}
],
title
:
[
{
left
:
'center'
,
text
:
'Gradient along the y axis'
},
},
{
xAxis
:
{
top
:
'55%'
,
type
:
'category'
,
left
:
'center'
,
axisLabel
:
{
text
:
'Gradient along the x axis'
color
:
'#606266'
,
}
// color: axisLabelColor ? (value, index) => axisLabelColor(value, index) : '#606266',
],
fontSize
:
'0.8em'
tooltip
:
{
},
trigger
:
'axis'
},
xAxis
:
[
{
data
:
[]
data
:
[]
},
},
{
yAxis
:
{
data
:
[],
type
:
'value'
,
gridIndex
:
1
splitLine
:
{
}
lineStyle
:
{
],
color
:
'#606266'
yAxis
:
[
}
{},
}
{
gridIndex
:
1
}
],
grid
:
[
{
bottom
:
'60%'
},
},
{
series
:
[
top
:
'60%'
{
}
type
:
'line'
,
],
itemStyle
:
{
series
:
[
color
:
'#F5AA01'
{
},
type
:
'line'
,
showSymbol
:
false
,
// 节点,平滑曲线
data
:
[]
symbol
:
'none'
,
},
smooth
:
true
,
{
// 折线背景色
type
:
'line'
,
areaStyle
:
{
showSymbol
:
false
,
color
:
{
data
:
[],
type
:
'linear'
,
xAxisIndex
:
1
,
x
:
0
,
yAxisIndex
:
1
y
:
0
,
}
x2
:
0
,
]
y2
:
1
,
colorStops
:
[
{
offset
:
0
,
color
:
'rgba(254, 84, 0, 0.6)'
},
{
offset
:
1
,
color
:
'rgba(254, 84, 0, 0.05)'
}
]
}
},
data
:
[]
}
]
}
return
lineOptions
}
}
export
default
l
ineOptions
export
default
getL
ineOptions
src/views/afterSales/file.vue
View file @
30135bb
...
@@ -8,11 +8,18 @@
...
@@ -8,11 +8,18 @@
<
template
>
<
template
>
<div>
<div>
<div
class=
"title"
>
售后档案客户
</div>
<div
class=
"title"
>
售后档案客户
</div>
<echart-line
:height=
"height"
></echart-line>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
'File'
name
:
'File'
,
props
:
{
height
:
{
type
:
String
,
default
:
'19.8vh'
}
}
}
}
</
script
>
</
script
>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment