优化统计图显示

master
lemon橪 2022-06-15 18:48:43 +08:00
parent 59cfa0efb0
commit 9a3d202524
5 changed files with 27 additions and 21 deletions

View File

@ -143,7 +143,7 @@ export default {
position: absolute; position: absolute;
left: -360px; left: -360px;
top: -9px; top: -9px;
width: 150px; max-width: 150px;
cursor: pointer; cursor: pointer;
} }
.store-search{ .store-search{

View File

@ -387,6 +387,8 @@ export default {
stroke: "#fff", stroke: "#fff",
lineWidth: 1, lineWidth: 1,
}); });
this.orderChart.area().position("createTime*price").color("title").shape("smooth");
this.orderChart.render(); this.orderChart.render();
}, },
@ -414,12 +416,7 @@ export default {
console.log("pv", data); console.log("pv", data);
this.pvChart.data(data); this.pvChart.data(data);
this.pvChart.scale({
activeQuantity: {
range: [0, 1],
nice: true,
},
});
this.pvChart.tooltip({ this.pvChart.tooltip({
showCrosshairs: true, showCrosshairs: true,
shared: true, shared: true,
@ -442,6 +439,7 @@ export default {
stroke: "#fff", stroke: "#fff",
lineWidth: 1, lineWidth: 1,
}); });
this.pvChart.area().position("date*pv").color("title").shape("smooth");
this.pvChart.render(); this.pvChart.render();
}, },
@ -498,19 +496,14 @@ export default {
lastNum.push({ lastNum.push({
date: item.date.substring(5), date: item.date.substring(5),
title: "历史记录", title: "上周记录",
lastNum: item.lastNum || 0, lastNum: item.lastNum || 0,
res: item.lastNum || 0, res: item.lastNum || 0,
}); });
}); });
let params = [...num, ...lastNum]; let params = [...num, ...lastNum];
this.historyMemberChart.data(params); this.historyMemberChart.data(params);
this.historyMemberChart.scale({
activeQuantity: {
range: [0, 1],
nice: true,
},
});
this.historyMemberChart.tooltip({ this.historyMemberChart.tooltip({
showCrosshairs: true, showCrosshairs: true,
shared: true, shared: true,
@ -519,15 +512,22 @@ export default {
this.historyMemberChart this.historyMemberChart
.line() .line()
.position("date*res") .position("date*res")
.color("title", ["#ffaa71", "#398AB9"]) .color("title")
.label("res") .label("res")
.shape("smooth"); .shape("smooth");
this.historyMemberChart this.historyMemberChart
.point() .point()
.position("date*res") .position("date*res")
.color("title", ["#ffaa71", "#398AB9"]) .color("title")
.label("res") .label("res")
.shape("circle"); .shape("circle");
this.historyMemberChart
.area()
.position("date*res")
.color("title")
.shape("smooth");
this.historyMemberChart.render(); this.historyMemberChart.render();
}, },
// //

View File

@ -8,7 +8,7 @@
<Card class="card"> <Card class="card">
<div> <div>
<h4>客户增长趋势</h4> <h4>客户增长趋势 <Button style="margin-left:10px" @click="()=>{enableShowMemberCount = !enableShowMemberCount; initMemberChart()}" size="small">{{enableShowMemberCount ? '关闭' : '显示'}}用户总人数</Button></h4>
<div id="orderChart"></div> <div id="orderChart"></div>
</div> </div>
</Card> </Card>
@ -84,6 +84,7 @@ export default {
}, },
data: [], // data: [], //
enableShowMemberCount:false
}; };
}, },
watch: { watch: {
@ -111,21 +112,21 @@ export default {
let actives = []; let actives = [];
this.data.forEach((item) => { this.data.forEach((item) => {
if (item.memberCount!="" || item.memberCount!=null) { if (this.enableShowMemberCount && (item.memberCount!="" || item.memberCount!=null)) {
count.push({ count.push({
createDate: item.createDate, createDate: item.createDate,
memberCount: item.memberCount, memberCount:item.memberCount,
title: "当前会员数量", title: "当前会员数量",
}); });
} }
if (item.newlyAdded!="" || item.newlyAdded!=null) { if (!this.enableShowMemberCount && (item.newlyAdded!="" || item.newlyAdded!=null)) {
newly.push({ newly.push({
createDate: item.createDate, createDate: item.createDate,
memberCount: item.newlyAdded, memberCount: item.newlyAdded,
title: "新增会员数量", title: "新增会员数量",
}); });
} }
if (item.activeQuantity!="" || item.activeQuantity!=null) { if (!this.enableShowMemberCount && (item.activeQuantity!="" || item.activeQuantity!=null)) {
actives.push({ actives.push({
createDate: item.createDate, createDate: item.createDate,
memberCount: item.activeQuantity, memberCount: item.activeQuantity,
@ -165,6 +166,8 @@ export default {
stroke: "#fff", stroke: "#fff",
lineWidth: 1, lineWidth: 1,
}); });
this.orderChart.area().position("createDate*memberCount").color("title").shape("smooth");
this.orderChart.render(); this.orderChart.render();
}, },

View File

@ -563,6 +563,8 @@ export default {
stroke: "#fff", stroke: "#fff",
lineWidth: 1, lineWidth: 1,
}); });
this.orderChart.area().position("createTime*price").color("title").shape("smooth");
this.orderChart.render(); this.orderChart.render();
}, },

View File

@ -173,6 +173,7 @@ export default {
stroke: "#fff", stroke: "#fff",
lineWidth: 1, lineWidth: 1,
}); });
this.orderChart.area().position("date*pv").color("title").shape("smooth");
this.orderChart.render(); this.orderChart.render();
}, },