From ac67833166253013a95941972426d3636fbc933d Mon Sep 17 00:00:00 2001 From: xiaowuler Date: Fri, 29 Apr 2022 17:08:04 +0800 Subject: [PATCH] modify some codes --- .../src/main/resources/application.yml | 8 ++--- .../Frontend/src/components/RamanLidar.vue | 17 +++++----- .../Frontend/src/model/high-chart-create.ts | 31 +++++++++++++++++++ 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/04.系统编码/Backend/src/main/resources/application.yml b/04.系统编码/Backend/src/main/resources/application.yml index 73b78c0..9a2f6af 100644 --- a/04.系统编码/Backend/src/main/resources/application.yml +++ b/04.系统编码/Backend/src/main/resources/application.yml @@ -20,9 +20,9 @@ custom: image: url: ${custom.parent-url}:${server.port}/product gifPath: ${custom.image.path}/gif - path: D:/Deployments/LamanRadar/product - parent-url: http://localhost -# path: /home/project/NJEnvironmentPlatform/html/product -# parent-url: http://10.124.102.10 +# path: D:/Deployments/LamanRadar/product +# parent-url: http://localhost + path: /home/project/NJEnvironmentPlatform/html/product + parent-url: http://10.124.102.10 # path: /home/develop/product # parent-url: http://rdp.nagr.com.cn diff --git a/04.系统编码/Frontend/src/components/RamanLidar.vue b/04.系统编码/Frontend/src/components/RamanLidar.vue index 455d4fe..6d4cb0b 100644 --- a/04.系统编码/Frontend/src/components/RamanLidar.vue +++ b/04.系统编码/Frontend/src/components/RamanLidar.vue @@ -383,7 +383,8 @@ export default { creates.opticalThickness = new HighChartCreate('opticalThickness'); creates.opticalThickness.setChart(); // creates.opticalThickness.setSpecialXAxis('时间(小时)', 24, 0, 2); - creates.opticalThickness.setXAxis('时间(天/时)', false); + // creates.opticalThickness.setXAxis('时间(天/时)', false); + creates.opticalThickness.setXAxisTypeDate(); creates.opticalThickness.setYAxis('光学厚度', 6, 0, 1, 7); creates.opticalThickness.setLegend(true); creates.opticalThickness.setTooltip('{point.y}'); @@ -622,10 +623,9 @@ export default { const drawAerosolCharts = (result: CustomeArray) => { if (result.length != 24) return; - const data = prepareChartData(result); - creates.opticalThickness.updateSeries(0, data) - creates.opticalThickness.updateXAxis(options.chartTimeData, 0) + creates.opticalThickness.updateSeries(0, data); + // creates.opticalThickness.updateXAxis(options.chartTimeData, 0) options.loadingOpticalThicknessStatus = false } @@ -633,7 +633,7 @@ export default { if (result.length != 24) return; const data = prepareChartData(result); creates.opticalThickness.updateSeries(1, data) - creates.opticalThickness.updateXAxis(options.chartTimeData, 0) + // creates.opticalThickness.updateXAxis(options.chartTimeData, 0) options.loadingOpticalThicknessStatus = false } @@ -641,7 +641,7 @@ export default { if (result.length != 24) return; const data = prepareChartData(result); creates.opticalThickness.updateSeries(2, data) - creates.opticalThickness.updateXAxis(options.chartTimeData, 0) + // creates.opticalThickness.updateXAxis(options.chartTimeData, 0) options.loadingOpticalThicknessStatus = false } @@ -670,7 +670,7 @@ export default { options.chartTimeData.push(item.time) if (item.data == null) { let temp = []; - for (let i = 0; i < 60; i++) { + for (let i = 0; i < 11; i++) { temp.push(NaN); } item.data = [temp]; @@ -681,8 +681,9 @@ export default { }) let interval = (24 / prepareData.length); let data = []; + let startTimeMoment = moment(result[0].time, 'M_D_H').add(8, 'h').add(-30, 'm'); for (let i = 0, len = prepareData.length; i < len; i++) { - data.push([parseFloat((interval * i).toFixed(2)), prepareData[i]]) + data.push([startTimeMoment.clone().add(interval * i, 'h').valueOf(), prepareData[i]]); } return data; } diff --git a/04.系统编码/Frontend/src/model/high-chart-create.ts b/04.系统编码/Frontend/src/model/high-chart-create.ts index be69cb2..ae15707 100644 --- a/04.系统编码/Frontend/src/model/high-chart-create.ts +++ b/04.系统编码/Frontend/src/model/high-chart-create.ts @@ -11,6 +11,7 @@ export class HighChartCreate { private series: Array = []; private legend: any = null; private tooltip: any = null; + private time: any = null; constructor(id: string) { this.id = id; @@ -40,6 +41,33 @@ export class HighChartCreate { showFirstLabel: true, }); } + + public setXAxisTypeDate(): void{ + this.time = { + useUTC: false + } + + this.xAxis.push({ + type: 'datetime', + labels: { + formatter: function () { + console.log(this) + return Highcharts.dateFormat('%d日%H时', this.value); + } + } + // dateTimeLabelFormats: { + // millisecond: '%H:%M:%S.%L', + // second: '%H:%M:%S', + // minute: '%H:%M', + // hour: '%H:%M', + // day: '%m-%d', + // week: '%m-%d', + // month: '%Y-%m', + // year: '%Y' + // } + }) + } + public setSpecialXAxis(text: string, max: number, min: number, tickInterval: number, opposite: boolean = false, lineWidth: number = 1, reversed: boolean = true) { this.xAxis.push({ title: { @@ -140,6 +168,9 @@ export class HighChartCreate { if (this.legend != null) options.legend = this.legend; + if (this.time != null) + options.time = this.time; + return options; }