diff --git a/src/components/chart/lineChart.vue b/src/components/chart/lineChart.vue index 4656875a..cef31f48 100644 --- a/src/components/chart/lineChart.vue +++ b/src/components/chart/lineChart.vue @@ -152,8 +152,7 @@ export default { watch: { list: { handler(newVal) { - if (newVal.length!=0) { - + if (newVal.length != 0) { // x轴的数据 this.xData = newVal.map(val => { return val.time; @@ -182,7 +181,7 @@ export default { confine: true }; this.series[0].name = '总量'; - console.log("折线图",newVal) + console.log('折线图', newVal); // 映射出类型数组 let arr = newVal.map(function(ele) { if (ele.type_data != null) { @@ -197,10 +196,8 @@ export default { } var lineArr = []; // 遍历需要多少条类型折线 - if (this.typeValue) { - console.log("this.typeValue.type_data",this.typeValue.type_data) - if (this.typeValue.type_data!=undefined) { - this.typeValue.type_data.forEach(ele => { + if (newVal[0].type_data != undefined) { + newVal[0].type_data.forEach(ele => { lineArr.push({ name: ele.name, type: 'line', @@ -208,9 +205,7 @@ export default { smooth: true }); }); - } } - // 筛选类型的数量 mapN.forEach(ele => { if (ele.name == '机动车') { @@ -256,7 +251,7 @@ export default { return ele.in_flow + ele.out_flow; }); } else if (this.title == '车头时距') { - console.log("车头时距",newVal) + console.log('车头时距', newVal); this.tooltip = { formatter: '{a} {b}:{c}/s', show: true, @@ -275,7 +270,7 @@ export default { }); } else if (this.title == '延误') { this.series[0].data = newVal.map(val => { - return val.ave_delay; + return val.ave_delay; }); } else if (this.title == '拥堵') { this.series[0].data = newVal.map(val => {}); @@ -288,7 +283,7 @@ export default { } }, immediate: true - }, + } } };