运行图解析调整

This commit is contained in:
fan 2021-05-10 14:40:37 +08:00
parent d0ce678ca0
commit 4f07f16ecf
2 changed files with 105 additions and 4 deletions

View File

@ -171,7 +171,7 @@ class EqualDistanceParser {
var nextPoint = [this.getCoordXByElem(stations, kmRangeMap, elem), parseInt(elem.secondTime), directionCode]; var nextPoint = [this.getCoordXByElem(stations, kmRangeMap, elem), parseInt(elem.secondTime), directionCode];
if (serie.data.length > 0) { if (serie.data.length > 0) {
var lastPoint = serie.data[serie.data.length - 1]; var lastPoint = serie.data[serie.data.length - 1];
if (lastPoint[2] !== nextPoint[2]) { if (lastPoint[2] !== nextPoint[2] && !elem.frontTurnBack) {
serie.data.push([this.getValueXByDirectionCode(lastPoint[0], lastPoint[2]), lastPoint[1], lastPoint[2]]); serie.data.push([this.getValueXByDirectionCode(lastPoint[0], lastPoint[2]), lastPoint[1], lastPoint[2]]);
serie.data.push([this.getValueXByDirectionCode(nextPoint[0], lastPoint[2]), nextPoint[1], lastPoint[2]]); serie.data.push([this.getValueXByDirectionCode(nextPoint[0], lastPoint[2]), nextPoint[1], lastPoint[2]]);
} }

View File

@ -496,7 +496,11 @@ export default {
this.option.series = []; this.option.series = [];
const kmRangeMap = this.planParser.convertStationsToMap(stations); const kmRangeMap = this.planParser.convertStationsToMap(stations);
this.pushModels(this.option.series, [this.planParser.initializeAxisY(this.stations)]); if (this.$route.query.lineCode === '07') {
this.pushModels(this.option.series, [this.planParser.initializeAxisX(stations)]);
} else {
this.pushModels(this.option.series, [this.planParser.initializeAxisY(stations)]);
}
this.pushModels(this.option.series, this.planParser.convertDataToModels(planData, stations, kmRangeMap, { width: 0.5, color: '#000' })); this.pushModels(this.option.series, this.planParser.convertDataToModels(planData, stations, kmRangeMap, { width: 0.5, color: '#000' }));
await this.loadInitChart(); await this.loadInitChart();
@ -508,6 +512,89 @@ export default {
} }
}, },
async loadInitData() { async loadInitData() {
const hebXAxis = {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 1,
color: '#d14a61'
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
};
const hebYAxis = [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 1,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
];
const hebDataZoom = [
{
type: 'inside',
yAxisIndex: 0
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
yAxisIndex: 0,
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
left: '20px'
}
];
if (this.$route.query.lineCode === '07') {
this.option.xAxis = hebXAxis;
this.option.yAxis = hebYAxis;
this.option.dataZoom = hebDataZoom;
}
await this.xAxisInit(); await this.xAxisInit();
await this.yAxisInit(); await this.yAxisInit();
// await this.loadInitChart(); // await this.loadInitChart();
@ -592,7 +679,11 @@ export default {
const startValue = 3600 * 6; const startValue = 3600 * 6;
const offsetTime = 3600 * 1; const offsetTime = 3600 * 1;
if (this.$route.query.lineCode === '07') {
this.option.yAxis[0].data = list;
} else {
this.option.xAxis[0].data = list; this.option.xAxis[0].data = list;
}
if (!this.option.dataZoom[0].startValue) { if (!this.option.dataZoom[0].startValue) {
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime; this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
} }
@ -602,10 +693,19 @@ export default {
} }
}, },
yAxisInit() { yAxisInit() {
if (Object.keys(this.planParser).length) { // if (Object.keys(this.planParser).length) {
// this.pushModels(this.option.series, [this.planParser.initializeAxisY(this.stations)]);
// this.option.yAxis.min = this.planParser.computedAxisYMinValue(this.stations);
// this.option.yAxis.max = this.planParser.computedAxisYMaxValue(this.stations);
// }
if (Object.keys(this.planParser).length && this.$route.query.lineCode !== '07') {
this.pushModels(this.option.series, [this.planParser.initializeAxisY(this.stations)]); this.pushModels(this.option.series, [this.planParser.initializeAxisY(this.stations)]);
this.option.yAxis.min = this.planParser.computedAxisYMinValue(this.stations); this.option.yAxis.min = this.planParser.computedAxisYMinValue(this.stations);
this.option.yAxis.max = this.planParser.computedAxisYMaxValue(this.stations); this.option.yAxis.max = this.planParser.computedAxisYMaxValue(this.stations);
} else if (Object.keys(this.planParser).length && this.$route.query.lineCode === '07') {
this.pushModels(this.option.series, [this.planParser.initializeAxisX(this.stations)]);
this.option.xAxis.min = this.planParser.computedAxisXMinValue(this.stations);
this.option.xAxis.max = this.planParser.computedAxisXMaxValue(this.stations);
} }
}, },
axisTooltip(param) { axisTooltip(param) {
@ -688,6 +788,7 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
overflow: hidden;
.left { .left {
height: 100%; height: 100%;