Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
glsk-data-view-pd
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 54fcd79a
authored
Jul 07, 2023
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交趋势图
1 parent
526d2b54
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
60 deletions
src/components/BarChart.vue
src/components/BarLineOptions.js
src/components/BarOptions.js
src/views/home/solar/ContentLeft.vue
src/views/home/solar/MerchantTrends.vue
src/views/home/solar/PurchaseTrends.vue
src/components/BarChart.vue
View file @
54fcd79
...
...
@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-07 14:01:42
* @LastEditors: huyue
* @LastEditTime: 2023-07-07 14:
04:45
* @LastEditTime: 2023-07-07 14:
24:23
-->
<
template
>
<div>
...
...
@@ -13,7 +13,7 @@
<
script
type=
"text/ecmascript-6"
>
import
*
as
echarts
from
'echarts'
import
getBarLineOptions
from
'./BarLine
Options'
import
BarOptions
from
'./Bar
Options'
export
default
{
name
:
'BarChart'
,
props
:
{
...
...
@@ -62,7 +62,7 @@ export default {
}
},
created
()
{
this
.
barLineOptions
=
getBarLine
Options
({
tooltipFormatter
:
this
.
tooltipFormatter
})
this
.
barLineOptions
=
Bar
Options
({
tooltipFormatter
:
this
.
tooltipFormatter
})
},
mounted
()
{
this
.
barLineDom
=
document
.
getElementById
(
this
.
domId
)
...
...
@@ -80,12 +80,11 @@ export default {
})
return
_txt
},
drawBar
Line
()
{
drawBar
()
{
console
.
log
(
this
.
dataList
)
this
.
barLineOptions
.
xAxis
.
data
=
this
.
dataList
.
map
(
item
=>
item
.
month
)
this
.
barLineOptions
.
series
[
0
].
data
=
this
.
dataList
.
map
(
item
=>
item
.
data1
)
this
.
barLineOptions
.
series
[
1
].
data
=
this
.
dataList
.
map
(
item
=>
item
.
data2
)
this
.
barLineOptions
.
series
[
2
].
data
=
this
.
dataList
.
map
(
item
=>
item
.
data3
)
this
[
this
.
domId
].
setOption
(
this
.
barLineOptions
)
}
}
...
...
src/components/BarLineOptions.js
View file @
54fcd79
...
...
@@ -48,7 +48,7 @@ function getBarLineOptions(obj) {
grid
:
{
left
:
'3%'
,
right
:
'4%'
,
top
:
'
1
0%'
,
top
:
'
2
0%'
,
bottom
:
'6%'
,
containLabel
:
true
},
...
...
@@ -59,7 +59,9 @@ function getBarLineOptions(obj) {
stack
:
'one'
,
data
:
[],
label
:
{
show
:
true
show
:
true
,
position
:
'insideTop'
,
color
:
'#fff'
},
itemStyle
:
{
barBorderRadius
:
[
2
,
2
,
0
,
0
],
// 柱体圆角
...
...
@@ -97,7 +99,9 @@ function getBarLineOptions(obj) {
type
:
'bar'
,
stack
:
'one'
,
label
:
{
show
:
true
show
:
true
,
position
:
'insideTop'
,
color
:
'#fff'
},
data
:
[],
itemStyle
:
{
...
...
src/components/BarOptions.js
View file @
54fcd79
/*
* @Description:
* @Author: huyue
* @Date: 2023-07-07 14:04:52
* @LastEditors: huyue
* @LastEditTime: 2023-07-07 14:35:44
*/
import
*
as
echarts
from
'echarts'
function
getBarLineOptions
(
obj
)
{
//
const { tooltipFormatter } = obj
const
{
tooltipFormatter
}
=
obj
var
barLineOption
=
{
tooltip
:
{
//
trigger: 'axis',
//
borderWidth: 0,
//
backgroundColor: 'rgba(68,68,68,0.80)',
//
textStyle: {
//
color: 'rgba(255,255,255,0.6)',
//
fontSize: '1.5px'
//
},
//
formatter: tooltipFormatter || '',
//
confine: true
trigger
:
'axis'
,
borderWidth
:
0
,
backgroundColor
:
'rgba(68,68,68,0.80)'
,
textStyle
:
{
color
:
'rgba(255,255,255,0.6)'
,
fontSize
:
'1.5px'
},
formatter
:
tooltipFormatter
||
''
,
confine
:
true
},
xAxis
:
{
data
:
[]
...
...
@@ -19,8 +26,8 @@ function getBarLineOptions(obj) {
yAxis
:
{
name
:
''
,
type
:
'value'
,
min
:
0
,
max
:
100
00
,
//
min: 0,
// max: 1
00,
splitLine
:
{
lineStyle
:
{
color
:
'#1d2a38'
...
...
@@ -38,7 +45,6 @@ function getBarLineOptions(obj) {
{
name
:
'bar'
,
type
:
'bar'
,
stack
:
'one'
,
data
:
[],
label
:
{
show
:
true
...
...
@@ -46,29 +52,18 @@ function getBarLineOptions(obj) {
itemStyle
:
{
barBorderRadius
:
[
2
,
2
,
0
,
0
],
// 柱体圆角
color
:
function
(
params
)
{
const
colorList
=
[
[
'#22D8FF'
,
'#5C56FF'
],
[
'#2AD190'
,
'#00B7DF'
],
[
'#22D8FF'
,
'#5C56FF'
],
[
'#2AD190'
,
'#00B7DF'
],
[
'#22D8FF'
,
'#5C56FF'
],
[
'#2AD190'
,
'#00B7DF'
],
[
'#22D8FF'
,
'#5C56FF'
],
[
'#2AD190'
,
'#00B7DF'
],
[
'#22D8FF'
,
'#5C56FF'
],
[
'#2AD190'
,
'#00B7DF'
],
[
'#22D8FF'
,
'#5C56FF'
],
[
'#2AD190'
,
'#00B7DF'
]
]
var
colorItem
=
colorList
[
params
.
dataIndex
]
return
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[{
// 代表渐变色从正上方开始
offset
:
0
,
// offset范围是0~1,用于表示位置,0是指0%处的颜色
color
:
colorItem
[
0
]
color
:
'#22D8FF'
},
// 柱图渐变色
{
offset
:
0.5
,
// 指100%处的颜色
color
:
'#223FA9'
},
{
offset
:
1
,
// 指100%处的颜色
color
:
colorItem
[
1
]
color
:
'#061422'
}]
)
}
...
...
@@ -77,7 +72,6 @@ function getBarLineOptions(obj) {
{
name
:
'bar2'
,
type
:
'bar'
,
stack
:
'one'
,
label
:
{
show
:
true
},
...
...
@@ -85,29 +79,18 @@ function getBarLineOptions(obj) {
itemStyle
:
{
barBorderRadius
:
[
2
,
2
,
0
,
0
],
// 柱体圆角
color
:
function
(
params
)
{
const
colorList
=
[
[
'#11627A'
,
'#282F7A'
],
[
'#145F4E'
,
'#035972'
],
[
'#11627A'
,
'#282F7A'
],
[
'#145F4E'
,
'#035972'
],
[
'#11627A'
,
'#282F7A'
],
[
'#145F4E'
,
'#035972'
],
[
'#11627A'
,
'#282F7A'
],
[
'#145F4E'
,
'#035972'
],
[
'#11627A'
,
'#282F7A'
],
[
'#145F4E'
,
'#035972'
],
[
'#11627A'
,
'#282F7A'
],
[
'#145F4E'
,
'#035972'
]
]
var
colorItem
=
colorList
[
params
.
dataIndex
]
return
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[{
// 代表渐变色从正上方开始
offset
:
0
,
// offset范围是0~1,用于表示位置,0是指0%处的颜色
color
:
colorItem
[
0
]
color
:
'#2AD191'
},
// 柱图渐变色
{
offset
:
0.5
,
// 指100%处的颜色
color
:
'#0E958D'
},
{
offset
:
1
,
// 指100%处的颜色
color
:
colorItem
[
1
]
color
:
'#061422'
}]
)
}
...
...
src/views/home/solar/ContentLeft.vue
View file @
54fcd79
...
...
@@ -3,20 +3,26 @@
* @Author: huyue
* @Date: 2023-07-05 10:35:43
* @LastEditors: huyue
* @LastEditTime: 2023-07-0
6 17:41:10
* @LastEditTime: 2023-07-0
7 14:19:28
-->
<
template
>
<div
class=
"left"
>
<StatisticsBox
:list=
"solarList"
bottomType=
"money"
></StatisticsBox>
<PurchaseTrends></PurchaseTrends>
<div
class=
"left-bottom"
>
<MerchantTrends
class=
"bottom-trends"
></MerchantTrends>
<div
class=
"bottom-storage"
>
ddd
</div>
</div>
</div>
</
template
>
<
script
type=
'text/ecmascript-6'
>
import
PurchaseTrends
from
'./PurchaseTrends.vue'
import
MerchantTrends
from
'./MerchantTrends.vue'
export
default
{
name
:
'ContentLeft'
,
components
:
{
PurchaseTrends
PurchaseTrends
,
MerchantTrends
},
data
()
{
return
{
...
...
@@ -63,5 +69,15 @@ export default {
width
:
64.17vw
;
overflow
:
hidden
;
//
background
:
#091C40
;
&-bottom
{
display
:
flex
;
.bottom-trends
{
width
:
43.33vw
;
margin-right
:
1.11vw
;
}
.bottom-storage
{
flex
:
1
;
}
}
}
</
style
>
src/views/home/solar/MerchantTrends.vue
0 → 100644
View file @
54fcd79
<!--
* @Description: 近一年采购额趋势图
* @Author: huyue
* @Date: 2023-07-06 16:19:15
* @LastEditors: huyue
* @LastEditTime: 2023-07-07 14:35:36
-->
<
template
>
<div
class=
"merchant-box"
>
<box-title
title=
"商户开通及使用趋势"
></box-title>
<BarChart
ref=
"merchantTrendsRef"
height=
"28.67vh"
domId=
"merchantTrends"
:dataList
.
sync=
"dataList"
:tooltipFormatterObj=
"tooltipFormatterObj"
></BarChart>
</div>
</
template
>
<
script
type=
"text/ecmascript-6"
>
import
{
changeMixin
}
from
'@/mixins'
export
default
{
name
:
'MerchantTrends'
,
mixins
:
[
changeMixin
],
data
()
{
return
{
tooltipFormatterObj
:
[
{
label
:
'商城'
,
attrName
:
'data1'
},
{
label
:
'自采'
,
attrName
:
'data2'
}
],
dataList
:
[]
}
},
mounted
()
{
},
methods
:
{
init
()
{
const
p
=
new
Promise
((
resolve
)
=>
{
for
(
let
i
=
0
;
i
<
12
;
i
++
)
{
this
.
dataList
.
push
({
month
:
i
+
1
+
'月'
,
data1
:
+
(
Math
.
random
()
*
20
).
toFixed
(
2
),
data2
:
+
(
Math
.
random
()
*
40
).
toFixed
(
2
)
})
}
resolve
()
})
p
.
then
(()
=>
{
this
.
$refs
.
merchantTrendsRef
.
drawBar
()
})
}
}
}
</
script
>
<
style
scoped
lang=
'scss'
>
.merchant-box
{
//
margin
:
1.78vh
0
;
background-color
:
#061422
;
box-shadow
:
inset
0
0
20px
0
#3d57ff69
;
}
</
style
>
src/views/home/solar/PurchaseTrends.vue
View file @
54fcd79
...
...
@@ -3,12 +3,12 @@
* @Author: huyue
* @Date: 2023-07-06 16:19:15
* @LastEditors: huyue
* @LastEditTime: 2023-07-07 1
3:54:35
* @LastEditTime: 2023-07-07 1
4:22:00
-->
<
template
>
<div
class=
"purchase-box"
>
<box-title
title=
"采购额排名"
></box-title>
<BarLineChart
ref=
"purchaseRef"
height=
"
25.37
vh"
domId=
"purchase"
:dataList
.
sync=
"dataList"
:tooltipFormatterObj=
"tooltipFormatterObj"
></BarLineChart>
<BarLineChart
ref=
"purchaseRef"
height=
"
30.26
vh"
domId=
"purchase"
:dataList
.
sync=
"dataList"
:tooltipFormatterObj=
"tooltipFormatterObj"
></BarLineChart>
</div>
</
template
>
...
...
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