测试 用electron + springboot 构建桌面应用
he wei
2022-03-18 020c6ebe0c43b0a0cedb1b91b3520d223b3415c3
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
<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) {
      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>