From a20806027fe8cf3a005ba6bc5ee51ea02ff108a8 Mon Sep 17 00:00:00 2001 From: xuhuihui <3548508071@qq.com> Date: Fri, 28 Jan 2022 13:35:37 +0800 Subject: [PATCH] commit --- .../src/components/MicrowaveRadiation.vue | 1552 ++++++++--------- .../Frontend/src/model/constant.ts | 3 + .../Frontend/src/model/high-chart-create.ts | 128 ++ .../Frontend/src/model/microwave-radiation.ts | 6 + 4 files changed, 834 insertions(+), 855 deletions(-) create mode 100644 04.系统编码/Frontend/src/model/constant.ts create mode 100644 04.系统编码/Frontend/src/model/high-chart-create.ts diff --git a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue index 67493e9..7979576 100644 --- a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue +++ b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue @@ -1,898 +1,740 @@ diff --git a/04.系统编码/Frontend/src/model/constant.ts b/04.系统编码/Frontend/src/model/constant.ts new file mode 100644 index 0000000..aea9397 --- /dev/null +++ b/04.系统编码/Frontend/src/model/constant.ts @@ -0,0 +1,3 @@ +export class Constant{ + public static readonly baseUrl: string = 'http://rdp.nagr.com.cn:18080'; +} \ No newline at end of file diff --git a/04.系统编码/Frontend/src/model/high-chart-create.ts b/04.系统编码/Frontend/src/model/high-chart-create.ts new file mode 100644 index 0000000..27a1903 --- /dev/null +++ b/04.系统编码/Frontend/src/model/high-chart-create.ts @@ -0,0 +1,128 @@ +import * as Highcharts from 'highcharts'; + +export class HighChartCreate { + + private readonly id: string; + + private highChart: any; + private chart: any; + private xAxis: Array = []; + private yAxis: Array = []; + private series: Array = []; + private legend: any = null; + private tooltip: any = null; + + constructor(id: string) { + this.id = id; + } + + public setChart(inverted: boolean = false, type: string = 'line'): void{ + this.chart = { + type: type, + inverted: inverted + }; + } + + public setXAxis(text: string, reversed: boolean = true){ + this.xAxis.push({ + reversed: reversed, + title: { + enabled: true, + text: text, + style: { + color: '#000000', + fontSize: '18px' + } + }, + categories: [], + showLastLabel: true, + showFirstLabel: true, + }); + } + + public setYAxis(text: string, max: number, min: number, tickInterval: number, tickAmount: number, opposite: boolean = false, lineWidth: number = 1, reversed: boolean = true){ + this.yAxis.push({ + title: { + text: text, + style: { + color: '#000000', + fontSize: '18px' + } + }, + max: max, + min: min, + tickInterval: tickInterval, + tickAmount: tickAmount, + lineWidth: lineWidth, + opposite: opposite + }); + } + + public setLegend(){ + this.legend = { + layout: 'vertical', + align: 'right', + verticalAlign: 'middle' + } + } + + public setTooltip(pointFormat: string, headerFormat: string = '{series.name}
'){ + this.tooltip = { + headerFormat: headerFormat, + pointFormat: pointFormat + } + } + + public setSeries(name: string) + public setSeries(name: string, yAxis: number = 0, valueSuffix: string = null, color: string = null){ + let series: any = { + name: name, + data: [], + } + if (color == null || valueSuffix == null){ + this.series.push(series); + return + } + + series.yAxis = yAxis; + series.tooltip = { + valueSuffix: valueSuffix + }; + series.color = color; + this.series.push(series); + } + + public init(): void{ + const options = this.getOptions(); + this.highChart = Highcharts.chart(this.id, options); + // return this.highChart; + } + + private getOptions(){ + let options: any = { + credits: { + enabled: false + }, + chart: this.chart, + title: { + text: null + }, + xAxis: this.xAxis, + yAxis: this.yAxis, + tooltip: this.tooltip, + series: this.series + }; + if (this.legend != null) + options.legend = this.legend; + + return options; + } + + public updateSeries(index: number, data: Array): void{ + this.highChart.series[index].setData(data); + } + + public updateXAxis(categories: Array, index: number = 0){ + this.highChart.xAxis[index].setCategories(categories); + } +} \ No newline at end of file diff --git a/04.系统编码/Frontend/src/model/microwave-radiation.ts b/04.系统编码/Frontend/src/model/microwave-radiation.ts index fb8e5d8..638b3bd 100644 --- a/04.系统编码/Frontend/src/model/microwave-radiation.ts +++ b/04.系统编码/Frontend/src/model/microwave-radiation.ts @@ -1,3 +1,5 @@ +import * as Highcharts from "highcharts"; + export class MicrowaveRadiation { /** @@ -35,4 +37,8 @@ export class MicrowaveRadiation { // splitNumber: 5 } } + + public static crateHighcharts(id: string, pointFormat: string, headerFormat: string = '{series.name}
'){ + + } } \ No newline at end of file