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
| <script>
| import BaseChart from "./BaseChart";
| import getYMax from "@/components/chart/js/getYMax";
| import getYMin from "@/components/chart/js/getYMin";
| export default {
| name: "NormalLines",
| extends: BaseChart,
| props: {
| unit: {
| type: String,
| default: "",
| }
| },
| data() {
| return {}
| },
| methods: {
| setData(data) {
| // debugger;
| let option = this.getOption(data);
| this.setOption(option);
| },
| getOption(data) {
| let xData = data && data.xData?data.xData: [];
| let series = data && data.series?data.series:[{
| type: "line",
| data: []
| }];
| let unit = this.unit;
| return {
| animation: false,
| tooltip:{
| trigger: 'axis',
| appendToBody: true,
| },
| grid: {
| top: "28px",
| left: '1%',
| right: '32px',
| bottom: '8px',
| containLabel: true
| },
| xAxis: {
| type: 'category',
| boundaryGap: 0,
| axisLine: {
| onZero: false
| },
| data: xData
| },
| yAxis: {
| type: 'value',
| name: unit?'Y('+unit+')':'Y',
| max: series[0].data.length == 0?1:getYMax,
| min: series[0].data.length == 0?0:getYMin,
| },
| series: series,
| }
| }
| },
| mounted() {
| this.setData();
| }
| }
| </script>
|
|