From 3b3521961c246eda35cde1fde685e3931f8af529 Mon Sep 17 00:00:00 2001 From: wente <329538422@qq.com> Date: 星期一, 28 十月 2024 08:46:25 +0800 Subject: [PATCH] 仿真字体 数量提示 箭头缝隙 --- web/src/views/modules/taskReliability/SimulatCurve.vue | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 107 insertions(+), 12 deletions(-) diff --git a/web/src/views/modules/taskReliability/SimulatCurve.vue b/web/src/views/modules/taskReliability/SimulatCurve.vue index dbe4b67..835cab1 100644 --- a/web/src/views/modules/taskReliability/SimulatCurve.vue +++ b/web/src/views/modules/taskReliability/SimulatCurve.vue @@ -1,39 +1,134 @@ <template> <div class="mod-taskReliability-taskPhase"> - <div class="echart" id="mychart" :style="myChartStyle"></div> + <div class="echart" id="myChart" :style="myChartStyle"></div> </div> </template> <script> - import * as echarts from "echarts"; + import echart from "echarts"; export default { name: 'SimulatCurve', data() { return { + xDataList: [], + yDataList: [], + mttr: '', + mtbf: '', + msr: '', myChart: {}, - myChartStyle: {float: "left", width: "100%", height: "400px"} //鍥捐〃鏍峰紡 + myChartStyle: {float: "left", width: "100%", height: "680px"}, //鍥捐〃鏍峰紡 + option: {} } }, components: {}, methods: { - initEcharts(CurveData) { - console.log(eval(CurveData), 'initEcharts(CurveData)') - const option = { - xAxis: { - data: eval(CurveData)[0] + async initEcharts(Param) { + console.log(Param) + let res = await this.$http.post(`/taskReliability/SimulatAssess/getResultXML`, Param) + console.log(res.data) + if (res.data) { + this.yDataList = res.data.curveParam.ydata + this.xDataList = res.data.curveParam.xdata + this.mttr = res.data.mttr.toFixed(4) + this.mtbf = res.data.mtbf.toFixed(4) + this.msr = res.data.msr.toFixed(4) + } + this.option = { + title: { + text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, + textStyle: { // 涓绘爣棰樻枃鏈牱寮弡"fontSize": 18,"fontWeight": "bolder","color": "#333"} + fontFamily: 'Arial', + fontSize: 30, + fontStyle: 'normal', + fontWeight: 'normal', + }, + textAlign: 'auto',//鏁翠綋锛堝寘鎷� text 鍜� subtext锛夌殑姘村钩瀵归綈 + textVerticalAlign: 'auto',//鏁翠綋锛堝寘鎷� text 鍜� subtext锛夌殑鍨傜洿瀵归綈 + padding: 0,//[5,10] | [ 5,6, 7, 8] ,鏍囬鍐呰竟璺� + left: 'center',//'5' | '5%'锛宼itle 缁勪欢绂诲鍣ㄥ乏渚х殑璺濈 + right: 'auto',//'title 缁勪欢绂诲鍣ㄥ彸渚х殑璺濈 + top: '20',//title 缁勪欢绂诲鍣ㄤ笂渚х殑璺濈 + bottom: 'auto',//title 缁勪欢绂诲鍣ㄤ笅渚х殑璺濈 }, - yAxis: {}, + xAxis: { + data: this.xDataList, + name: '浠跨湡鎬绘椂闀�', + type: 'category', + axisLabel: { + formatter: function(value) { + // 灏� X 杞村埢搴﹀�兼牸寮忓寲涓轰繚鐣欎袱浣嶅皬鏁扮殑瀛楃涓� + return parseFloat(value).toFixed(2); + } + } + }, + yAxis: { + type:"value", + name: '鍙潬搴�', + }, series: [ { - data: eval(CurveData)[1], + data: this.yDataList, type: 'line', smooth: true } ] }; - this.myChart = echarts.init(document.getElementById("mychart")); - this.myChart.setOption(option); + this.myChart = echart.init(document.getElementById("myChart")); + console.log(this.option, ' this.option ') + this.myChart.setOption(this.option); + //闅忕潃灞忓箷澶у皬璋冭妭鍥捐〃 + window.addEventListener("resize", () => { + this.myChart.resize(); + }); + }, + async getProductEcharts(Param) { + let res = await this.$http.post(`/taskReliability/SimulatAssess/getResultData`, Param) + console.log(res.data) + if (res.data) { + this.yDataList = res.data.curveParam.ydata + this.xDataList = res.data.curveParam.xdata + this.mttr = res.data.mttr.toFixed(4) + this.mtbf = res.data.mtbf.toFixed(4) + this.msr = res.data.msr.toFixed(4) + } + this.option = { + title: { + text: "mttf:" + this.mtbf + " mttr:" + this.mttr + " msr:" + this.msr, + textStyle: { // 涓绘爣棰樻枃鏈牱寮弡"fontSize": 18,"fontWeight": "bolder","color": "#333"} + fontFamily: 'Arial', + fontSize: 30, + fontStyle: 'normal', + fontWeight: 'normal', + }, + textAlign: 'auto',//鏁翠綋锛堝寘鎷� text 鍜� subtext锛夌殑姘村钩瀵归綈 + textVerticalAlign: 'auto',//鏁翠綋锛堝寘鎷� text 鍜� subtext锛夌殑鍨傜洿瀵归綈 + padding: 0,//[5,10] | [ 5,6, 7, 8] ,鏍囬鍐呰竟璺� + left: 'center',//'5' | '5%'锛宼itle 缁勪欢绂诲鍣ㄥ乏渚х殑璺濈 + right: 'auto',//'title 缁勪欢绂诲鍣ㄥ彸渚х殑璺濈 + top: 'auto',//title 缁勪欢绂诲鍣ㄤ笂渚х殑璺濈 + bottom: 'auto',//title 缁勪欢绂诲鍣ㄤ笅渚х殑璺濈 + }, + xAxis: { + data: this.xDataList, + name: '浠跨湡鎬绘椂闀�', + splitNumber: 10 + }, + yAxis: { + + name: '', + }, + series: [ + { + data: this.yDataList, + type: 'line', + smooth: true + } + ] + }; + this.myChart = echart.init(document.getElementById("myChart")); + console.log(this.option, ' this.option ') + this.myChart.setOption(this.option); //闅忕潃灞忓箷澶у皬璋冭妭鍥捐〃 window.addEventListener("resize", () => { this.myChart.resize(); -- Gitblit v1.9.1