修改3d饼图展示方式及数据处理

main
jinna 3 years ago
parent 1b887eee1c
commit 6cd0e04bd7
  1. BIN
      public/excel/wuliu.xlsx
  2. 33
      src/views/dashboard/home.vue

Binary file not shown.

@ -394,7 +394,6 @@ export default {
this.content = this.transformSheets(sheets); this.content = this.transformSheets(sheets);
}) })
.catch((err) => { .catch((err) => {
console.log(err)
this.$message.error(err); this.$message.error(err);
}); });
}, },
@ -406,8 +405,6 @@ export default {
const year = time.getFullYear(); const year = time.getFullYear();
const month = time.getMonth() + 1; const month = time.getMonth() + 1;
const date = time.getDate(); const date = time.getDate();
console.log(time.getHours());
console.log(time.getMinutes());
return ( return (
year + year +
format + format +
@ -421,7 +418,6 @@ export default {
for (const key in sheets) { for (const key in sheets) {
content1.push(XLSX.utils.sheet_to_json(sheets[key])); content1.push(XLSX.utils.sheet_to_json(sheets[key]));
} }
console.log(content1)
this.dayData.push( this.dayData.push(
{ name: "收件量", data: content1[0][0].日总收件量, huanbi: content1[0][0].收件量日总环比 }, { name: "收件量", data: content1[0][0].日总收件量, huanbi: content1[0][0].收件量日总环比 },
{ name: "发件量", data: content1[0][0].日总发件量, huanbi: content1[0][0].发件量日总环比 }, { name: "发件量", data: content1[0][0].日总发件量, huanbi: content1[0][0].发件量日总环比 },
@ -439,14 +435,12 @@ export default {
); );
this.totalData = this.dayData; this.totalData = this.dayData;
this.updateTime = this.formatDate(content1[0][0].日期,'/'); this.updateTime = this.formatDate(content1[0][0].日期,'/');
console.log(this.updateTime)
content1[1].map((item) => { content1[1].map((item) => {
// item..substring(item..length - 5).replace(".", "-") // item..substring(item..length - 5).replace(".", "-")
this.xData.unshift(this.formatDate(item.日期,'-').substring(this.formatDate(item.日期,'-').length - 5).replace(".", "-")); this.xData.unshift(this.formatDate(item.日期,'-').substring(this.formatDate(item.日期,'-').length - 5).replace(".", "-"));
this.yData1.push(item.到件量); this.yData1.push(item.到件量);
this.yData2.push(item.派件量); this.yData2.push(item.派件量);
}); });
console.log(this.xData)
content1[3].map((item) => { content1[3].map((item) => {
this.villageData.push({ name: item.村点名称, upData: item.上行, downData: item.下行 }); this.villageData.push({ name: item.村点名称, upData: item.上行, downData: item.下行 });
}); });
@ -481,20 +475,24 @@ export default {
return b.count - a.count; return b.count - a.count;
}); });
}); });
var pieArr = []
content1[0].map((item) => { content1[0].map((item) => {
this.pieData.push({ pieArr.push({
name: item.快递名称, name: item.快递名称,
y: item.收件量, y: item.收件量,
// percent: (item. / content1[0][0].).toFixed(4) * 100, // percent: (item. / content1[0][0].).toFixed(4) * 100,
}); });
}); });
this.pieData = this.pieData.sort(function (a, b) { pieArr = pieArr.sort(function (a, b) {
return b.y - a.y; return a.y - b.y;
}); });
this.pieData[0].h = 15; pieArr.map((item,index) =>{
this.pieData[1].h = 10; this.pieData.push({
this.pieData[2].h = 5; name: item.name,
y: item.y,
h:index + 1
})
})
this.shouData.map((item, index) => { this.shouData.map((item, index) => {
if (index <= 10) { if (index <= 10) {
this.slideList[0].arr.push({ no: index + 1, name: item.name, count: item.count }); this.slideList[0].arr.push({ no: index + 1, name: item.name, count: item.count });
@ -872,7 +870,7 @@ export default {
backgroundColor: null, backgroundColor: null,
marginTop: -10, marginTop: -10,
}, },
colors: ["#00bdff", "#52f4c1", "#00dbec"], colors: ["#00bdff", "#52f4c1", "#00dbec","#ff56a1","#ffa04b","#8f58ff","#00c056","#ff3661","#ff3661"],
title: { title: {
text: "", text: "",
}, },
@ -888,6 +886,7 @@ export default {
cursor: "pointer", cursor: "pointer",
depth: this.fontSize(15), depth: this.fontSize(15),
dataLabels: { dataLabels: {
padding: 0,
enabled: true, //线tip enabled: true, //线tip
distance: "11%", distance: "11%",
connectorWidth: 1, connectorWidth: 1,
@ -898,14 +897,14 @@ export default {
}, },
formatter: function (params) { formatter: function (params) {
//this console.log(this) //this console.log(this)
return `<span class="my-class" style="color:#e39054;font-size:0.16rem">${ return `<span class="my-class" style="color:#e39054;font-size:0.14rem">${
this.key this.key
}:</span> }:</span>
<span style="color:#e39054;font-size:0.14rem;">${( <span style="color:#e39054;font-size:0.12rem;">${(
(this.y / this.total) * (this.y / this.total) *
100 100
).toFixed(2)}%</span><br /> ).toFixed(2)}%</span><br />
<span style="font-size:0.14rem;color:#fff;line-height: 0.12rem;font-family: 'FZSK';">${ <span style="font-size:0.12rem;color:#fff;line-height: 0.12rem;font-family: 'FZSK';">${
this.y this.y
}</span>`; }</span>`;
}, },

Loading…
Cancel
Save