diff --git a/src/jmapNew/theme/nanjing_02/planConvert.js b/src/jmapNew/theme/nanjing_02/planConvert.js index f352b834d..5e29e37f6 100644 --- a/src/jmapNew/theme/nanjing_02/planConvert.js +++ b/src/jmapNew/theme/nanjing_02/planConvert.js @@ -2,10 +2,10 @@ import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, pre import store from '@/store/index'; export default { /** 边缘高度*/ - EdgeHeight: 3, + EdgeHeight: 600, /** 间隔高度*/ - CoordMultiple: 3, + CoordMultiple: 1, /** 偏移时间*/ TranslationTime: 60 * 60 * 2, @@ -311,8 +311,15 @@ export default { return series; }, + /** 初始化Y轴*/ + initializeYaxis(stations) { + return createMarkLineModels(stations, (elem) => { + return this.EdgeHeight + elem.kmRange * this.CoordMultiple; + }); + }, + getYaxisValueByStation(station, index) { - return this.EdgeHeight + index * this.CoordMultiple; + return this.EdgeHeight + station.kmRange * this.CoordMultiple; }, /** 将后台数据转换为试图序列模型*/ @@ -326,52 +333,55 @@ export default { return map; }, - /** 初始化Y轴*/ - initializeYaxis(stations) { - return createMarkLineModels(stations, (elem, index) => { - return this.EdgeHeight + index * this.CoordMultiple; - }); - }, /** 计算y轴最小值*/ - computedYaxisMinValue() { - return 0; + computedYaxisMinValue(stations) { + return stations[0].kmRange * this.CoordMultiple; }, /** 计算y轴最大值*/ computedYaxisMaxValue(stations) { - return this.EdgeHeight * 2 + (stations.length - 1) * this.CoordMultiple; + return stations[stations.length - 1].kmRange * this.CoordMultiple + this.EdgeHeight * 2; }, /** 格式化y轴数据*/ computedFormatYAxis(stations, params) { var yText = '0m'; - var index = Math.floor((parseInt(params.value) - this.EdgeHeight) / this.CoordMultiple); - if (index >= 0 && index < stations.length) { - yText = Math.floor(stations[index].kmRange) + 'm'; - } + + stations.forEach(elem => { + if (elem.kmRange < parseInt(params.value) / this.CoordMultiple - this.EdgeHeight) { + yText = Math.floor(elem.kmRange) + 'm'; + } + }); + return yText; }, + /** 根据是否和上一个车次是否相交,计算下一个车次的折返的高度*/ + computedReentryNumber(code) { + // return parseInt(code || 1) % 2 ? 1 : 2; + return 1; + }, + /** 根据方向计算y折返偏移量*/ - getYvalueByDirectionCode(defaultVlue, directionCode) { + getYvalueByDirectionCode(defaultVlue, directionCode, num) { if (directionCode === '1') { - defaultVlue -= this.EdgeHeight / 2; + defaultVlue -= this.EdgeHeight / 2 * num; } else if (directionCode === '2') { - defaultVlue += this.EdgeHeight / 2; + defaultVlue += this.EdgeHeight / 2 * num; } return defaultVlue; }, /** 根据elem计算y值*/ - getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial) { + getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial, num) { var defaultVlue = 0; var station = stations.find(it => { return it.code == elem.stationCode; }); if (station) { defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; if (isSpecial) { - defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode); + defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode, num); } }