折线图

This commit is contained in:
Hobart 2023-02-22 16:47:04 +08:00
parent a0e97c56ee
commit 1d018c9bfd
1 changed files with 7 additions and 12 deletions

View File

@ -152,8 +152,7 @@ export default {
watch: { watch: {
list: { list: {
handler(newVal) { handler(newVal) {
if (newVal.length!=0) { if (newVal.length != 0) {
// x // x
this.xData = newVal.map(val => { this.xData = newVal.map(val => {
return val.time; return val.time;
@ -182,7 +181,7 @@ export default {
confine: true confine: true
}; };
this.series[0].name = '总量'; this.series[0].name = '总量';
console.log("折线图",newVal) console.log('折线图', newVal);
// //
let arr = newVal.map(function(ele) { let arr = newVal.map(function(ele) {
if (ele.type_data != null) { if (ele.type_data != null) {
@ -197,10 +196,8 @@ export default {
} }
var lineArr = []; var lineArr = [];
// 线 // 线
if (this.typeValue) { if (newVal[0].type_data != undefined) {
console.log("this.typeValue.type_data",this.typeValue.type_data) newVal[0].type_data.forEach(ele => {
if (this.typeValue.type_data!=undefined) {
this.typeValue.type_data.forEach(ele => {
lineArr.push({ lineArr.push({
name: ele.name, name: ele.name,
type: 'line', type: 'line',
@ -208,9 +205,7 @@ export default {
smooth: true smooth: true
}); });
}); });
}
} }
// //
mapN.forEach(ele => { mapN.forEach(ele => {
if (ele.name == '机动车') { if (ele.name == '机动车') {
@ -256,7 +251,7 @@ export default {
return ele.in_flow + ele.out_flow; return ele.in_flow + ele.out_flow;
}); });
} else if (this.title == '车头时距') { } else if (this.title == '车头时距') {
console.log("车头时距",newVal) console.log('车头时距', newVal);
this.tooltip = { this.tooltip = {
formatter: '{a} {b}:{c}/s', formatter: '{a} {b}:{c}/s',
show: true, show: true,
@ -275,7 +270,7 @@ export default {
}); });
} else if (this.title == '延误') { } else if (this.title == '延误') {
this.series[0].data = newVal.map(val => { this.series[0].data = newVal.map(val => {
return val.ave_delay; return val.ave_delay;
}); });
} else if (this.title == '拥堵') { } else if (this.title == '拥堵') {
this.series[0].data = newVal.map(val => {}); this.series[0].data = newVal.map(val => {});
@ -288,7 +283,7 @@ export default {
} }
}, },
immediate: true immediate: true
}, }
} }
}; };
</script> </script>