1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
| <template>
| <div class="mod-taskReliability-taskPhase">
| <div class="echart" id="mychart" :style="myChartStyle"></div>
| </div>
| </template>
|
| <script>
| import * as echarts from "echarts";
|
| export default {
| name: 'SimulatCurve',
| data() {
| return {
| xDataList: [],
| yDataList: [],
| myChart: {},
| myChartStyle: {float: "left", width: "100%", height: "600px"}, //图表样式
| option: {}
| }
| },
| components: {},
| methods: {
| initEcharts(id,taskId, samplPeriod) {
| this.option = {
| title: {
| text: '',
| textStyle: { // 主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"}
| fontFamily: 'Arial',
| fontSize: 20,
| fontStyle: 'normal',
| fontWeight: 'normal',
| }
| },
| xAxis: {
| data: [],
| name: '仿真次数'
| },
| yAxis: {},
| series: [
| {
| data: [],
| type: 'line',
| smooth: true
| }
| ]
| };
| this.getEchart(id,taskId, samplPeriod)
| },
| async getEchart(id,taskId, samplPeriod) {
| let task = await this.$http.get(`/taskReliability/Task/${taskId}`)
| samplPeriod = samplPeriod / 60
| let i = 0
| for (i = 0; i + samplPeriod <= task.taskDuration; i += samplPeriod) {
| this.series[0].data.push(i);
| }
| if (i !== task.taskDuration) {
| this.series[0].data.push(task.taskDuration);
| }
|
| let res = await this.$http.get(`/taskReliability/SimulatAssess/${id}`)
|
|
|
| this.myChart = echarts.init(document.getElementById("mychart"));
| this.myChart.setOption(this.option);
| //随着屏幕大小调节图表
| window.addEventListener("resize", () => {
| this.myChart.resize();
| });
| }
| }
| }
| </script>
| <style>
|
| </style>
|
|