Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-3
Overview
Overview
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
office
haoban-3
Commits
785d0781
Commit
785d0781
authored
Jul 28, 2022
by
shaojiawen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 图表
parent
23cfcce6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
48 deletions
+62
-48
actCodeDetailStatistics.vue
...ds/actCodeManage/staffActCode/actCodeDetailStatistics.vue
+11
-1
newAddChart.vue
...ews/salesleads/actCodeManage/staffActCode/newAddChart.vue
+51
-47
No files found.
src/views/salesleads/actCodeManage/staffActCode/actCodeDetailStatistics.vue
View file @
785d0781
...
@@ -127,7 +127,17 @@ export default {
...
@@ -127,7 +127,17 @@ export default {
let
resData
=
res
.
data
;
let
resData
=
res
.
data
;
that
.
loading
=
false
;
that
.
loading
=
false
;
if
(
resData
.
code
==
0
)
{
if
(
resData
.
code
==
0
)
{
that
.
overViewData
=
resData
.
result
||
{};
let
result
=
resData
.
result
||
{
addNumT
:
0
,
addNum
:
0
,
dateList
:
[]
};
// result.dateList = [
// { bizDate: '2018/8/1', 新增人数: 0 },
// { bizDate: '2018/8/2', 新增人数: 1 },
// { bizDate: '2018/8/3', 新增人数: 1 },
// { bizDate: '2018/8/4', 新增人数: 1 }
// ];
result
.
dateList
.
map
(
function
(
date
,
index
)
{
date
[
'新增人数'
]
=
date
.
addNum
;
});
that
.
overViewData
=
result
;
return
;
return
;
}
}
errMsg
.
errorMsg
(
resData
);
errMsg
.
errorMsg
(
resData
);
...
...
src/views/salesleads/actCodeManage/staffActCode/newAddChart.vue
View file @
785d0781
<
template
>
<
template
>
<div>
<div>
<div
:id=
"id"
></div>
<div
:id=
"id"
class=
"chart--nodata"
:style=
"!charData.length ? 'height:0;' : ''"
></div>
<div
v-if=
"!charData.length"
class=
"chart--nodata"
>
<div
v-if=
"!charData.length"
class=
"chart--nodata"
>
<div>
<div>
<img
class=
"image-120"
src=
"@/assets/no-data.svg"
/>
<img
class=
"image-120"
src=
"@/assets/no-data.svg"
/>
...
@@ -8,18 +8,11 @@
...
@@ -8,18 +8,11 @@
</div>
</div>
</div>
</div>
</div>
</div>
<!--
<div
:id=
"id"
></div>
-->
<!--
<div
v-if=
"!charData.length"
class=
"chart--nodata"
>
<div>
<img
class=
"image-120"
src=
"@/assets/no-data.svg"
/>
<p
class=
"font-14 color-606266 no-data-text"
>
暂无数据
</p>
</div>
</div>
-->
</
template
>
</
template
>
<
script
>
<
script
>
// import G2 from '@antv/g2';
import
*
as
G2
from
'@antv/g2'
;
import
*
as
G2
from
'@antv/g2'
;
import
filters
from
'@/filters/index'
;
export
default
{
export
default
{
components
:
{},
components
:
{},
data
()
{
data
()
{
...
@@ -31,7 +24,7 @@ export default {
...
@@ -31,7 +24,7 @@ export default {
charData
:
{
charData
:
{
type
:
Array
,
type
:
Array
,
default
()
{
default
()
{
return
[];
//{ bizDate: '2018/8/1', 新增人数: 4623 }
return
[];
}
}
},
},
id
:
String
id
:
String
...
@@ -62,18 +55,24 @@ export default {
...
@@ -62,18 +55,24 @@ export default {
padding
:
[
70
,
60
,
40
,
70
]
padding
:
[
70
,
60
,
40
,
70
]
});
});
//装载数据
//装载数据
let
list
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
charData
));
// this.chart.data(this.charData); // 载入数据源
list
.
sort
((
a
,
b
)
=>
{
this
.
chart
.
data
(
this
.
charData
,
{
return
b
.
新增人数
-
a
.
新增人数
;
bizDate
:
{
});
alias
:
'日期'
//别名
let
maxNum
=
list
[
0
][
'新增人数'
];
},
// console.log(list);
addNum
:
{
this
.
chart
.
data
(
this
.
charData
);
// 载入数据源
alias
:
'新增人数'
this
.
chart
.
scale
({
新增人数
:
{
// tickInterval: 1,
tickCount
:
maxNum
>
2
?
5
:
maxNum
+
1
,
minTickInterval
:
1
,
nice
:
true
,
min
:
0
// type: 'linear'
}
}
});
});
this
.
chart
.
axis
(
'新增人数'
,
{
this
.
chart
.
axis
(
'addNum'
,
{
grid
:
{
grid
:
{
line
:
{
line
:
{
type
:
'line'
,
type
:
'line'
,
...
@@ -93,42 +92,47 @@ export default {
...
@@ -93,42 +92,47 @@ export default {
}
}
}
}
});
});
this
.
chart
.
tooltip
({
//
this.chart.tooltip({
showCrosshairs
:
true
,
//
showCrosshairs: true,
shared
:
true
,
//
shared: true,
itemTpl
:
`<div style="margin-bottom: 10px;list-style:none;">
//
itemTpl: `
<
div
style
=
"margin-bottom: 10px;list-style:none;"
>
<span style="background-color:{color};" class="g2-tooltip-marker"></span>
//
<
span
style
=
"background-color:{color};"
class
=
"g2-tooltip-marker"
><
/span
>
{name}: {value}
//
{name}: {value}
</div>`
//
<
/div>
`
});
//
});
// 图例
// 图例
this
.
chart
.
legend
({
this
.
chart
.
legend
({
custom
:
true
,
custom
:
true
,
position
:
'top-left'
,
position
:
'top-left'
,
items
:
[{
name
:
'新增人数'
,
value
:
'
addNum
'
,
marker
:
{
symbol
:
'line'
,
style
:
{
stroke
:
'#4B74E8'
,
lineWidth
:
12
,
lineHeight
:
8
}
}
}]
items
:
[{
name
:
'新增人数'
,
value
:
'
新增人数
'
,
marker
:
{
symbol
:
'line'
,
style
:
{
stroke
:
'#4B74E8'
,
lineWidth
:
12
,
lineHeight
:
8
}
}
}]
});
});
if
(
this
.
charData
.
length
>
1
)
{
if
(
this
.
charData
.
length
>
1
)
{
this
.
chart
this
.
chart
.
line
()
.
line
()
.
position
(
'bizDate*addNum'
)
.
position
(
'bizDate*新增人数'
)
.
color
(
'#4B74E8'
)
.
color
(
'#4B74E8'
);
.
tooltip
(
'addNum'
,
addNum
=>
{
// .tooltip('addNum', addNum => {
return
{
// return {
name
:
'新增人数'
,
// name: '新增人数',
value
:
addNum
// value: addNum
};
// };
});
// });
}
else
{
}
else
if
(
this
.
charData
.
length
==
1
)
{
let
time
=
new
Date
(
this
.
charData
[
0
].
bizDate
).
getTime
();
let
start
=
{
新增人数
:
null
,
bizDate
:
filters
.
timeStampToYmd
(
time
-
86400000
)
};
let
end
=
{
新增人数
:
null
,
bizDate
:
filters
.
timeStampToYmd
(
time
+
86400000
)
};
let
list
=
[
start
,
this
.
charData
[
0
],
end
];
this
.
chart
.
data
(
list
);
this
.
chart
this
.
chart
.
point
()
.
point
()
.
position
(
'bizDate*
addNum
'
)
.
position
(
'bizDate*
新增人数
'
)
.
color
(
'#4B74E8'
)
.
color
(
'#4B74E8'
)
;
.
tooltip
(
'addNum'
,
addNum
=>
{
//
.tooltip('addNum', addNum => {
return
{
//
return {
name
:
'新增人数'
,
//
name: '新增人数',
value
:
addNum
//
value: addNum
};
//
};
});
//
});
}
}
this
.
chart
.
removeInteraction
(
'legend-filter'
);
// 自定义图例,移除默认的分类图例筛选交互
this
.
chart
.
removeInteraction
(
'legend-filter'
);
// 自定义图例,移除默认的分类图例筛选交互
...
@@ -140,7 +144,7 @@ export default {
...
@@ -140,7 +144,7 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.chart--nodata
{
.chart--nodata
{
height
:
256
px
;
height
:
359
px
;
width
:
100%
;
width
:
100%
;
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
...
...
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