哈尔滨项目打开运行图报错调整

This commit is contained in:
fan 2021-06-16 15:31:55 +08:00
parent a6ecb523f9
commit 5cf6a1e84f

View File

@ -257,7 +257,11 @@ export default {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
this.kmRangeMap = this.PlanParser.convertStationsToMap(stations);
this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisY(stations)]);
if (this.$route.query.lineCode === '07') {
this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]);
} else {
this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisY(stations)]);
}
this.staticSeries = this.pushModels(this.staticSeries, this.PlanParser.convertDataToModels(planData, stations, this.kmRangeMap, { color: '#000', width: 0.5 }));
this.staticSeries.forEach(item => {
this.seriesMap[item.name] = item;
@ -362,6 +366,89 @@ export default {
]
};
const hebXAxis = {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
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: 2,
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') {
option.xAxis = hebXAxis;
option.yAxis = hebYAxis;
option.dataZoom = hebDataZoom;
}
await this.xAxisInit(option);
await this.yAxisInit(option);
await this.loadInitChart(option);
@ -420,7 +507,11 @@ export default {
const startValue = 3600 * 6;
const offsetTime = 3600 * 1;
option.xAxis[0].data = list;
if (this.$route.query.lineCode === '07') {
option.yAxis[0].data = list;
} else {
option.xAxis[0].data = list;
}
if (!option.dataZoom[0].startValue) {
option.dataZoom[0].startValue = option.dataZoom[1].startValue = startValue - offsetTime;
}
@ -430,19 +521,31 @@ export default {
}
},
yAxisInit(option) {
if (Object.keys(this.PlanParser).length) {
option.yAxis[0].min = this.PlanParser.computedAxisYMinValue(this.stations);
option.yAxis[0].max = this.PlanParser.computedAxisYMaxValue(this.stations);
if (Object.keys(this.PlanParser).length && this.$route.query.lineCode !== '07') {
option.yAxis.min = this.PlanParser.computedAxisYMinValue(this.stations);
option.yAxis.max = this.PlanParser.computedAxisYMaxValue(this.stations);
} else if (Object.keys(this.PlanParser).length && this.$route.query.lineCode === '07') {
option.xAxis.min = this.PlanParser.computedAxisXMinValue(this.stations);
option.xAxis.max = this.PlanParser.computedAxisXMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = (this.$store.getters['map/getDeviceByCode'](param.data[2])) || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})<br>`
].join('');
if (this.$route.query.lineCode !== '07') {
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})<br>`
].join('');
} else {
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
`车站公里标: ${station.kmRange} km <br>`,
`到站时间: ${timeFormat(param.data[1] + this.PlanParser.getTranslation())} (${param.data[1]})<br>`
].join('');
}
},
renderTripNumber(params) {
const tripNumber = params.tripNumber; //