折线图
This commit is contained in:
parent
a0e97c56ee
commit
1d018c9bfd
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue