riku
2024-05-07 c4e9d054916c3f085329a67c7664b4c54f9137f9
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
 * 获取合适的字体大小
 */
function fGetChartFontSize() {
  const dpr = window.devicePixelRatio;
  let fontSize = 12;
  if (dpr == 2) {
    fontSize = 17;
  } else if (dpr == 3) {
    fontSize = 24;
  } else if (dpr > 3) {
    fontSize = 24;
  }
  return fontSize;
}
 
function factorLineOption(_xAxis, _series, legends) {
  var fontSize = fGetChartFontSize();
  return {
    animationEasing: 'elasticOut',
    animationDelayUpdate: function (idx) {
      return idx * 5;
    },
    // toolbox: {
    //   bottom: 0,
    //   feature: {
    //     dataZoom: {},
    //     magicType: {
    //       type: ['line', 'bar']
    //     },
    //     restore: {}
    //   }
    // },
    tooltip: {
      textStyle: {
        fontSize: fontSize
      }
    },
    legend: {
      type: 'scroll',
      data: legends,
      left: 0,
      textStyle: {
        fontSize: fontSize,
        color: 'white'
      }
    },
    xAxis: {
      name: '时间',
      data: _xAxis,
      axisLabel: {
        textStyle: {
          fontSize: fontSize
        },
        color: '#ffffff',
        textBorderColor: '#fff'
      },
      axisTick: {
        lineStyle: {
          color: 'white'
        },
        intervel: 0,
        inside: false
      },
 
      nameTextStyle: {
        color: '#ffffff'
      },
      axisLine: {
        lineStyle: {
          color: '#ffffff'
        }
      }
    },
    yAxis: {
      name: '浓度(μg/m³)',
      axisLabel: {
        textStyle: {
          fontSize: fontSize
        }
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: 'white'
        }
      },
      axisTick: {
        show: true,
        lineStyle: {
          color: 'white'
        }
      },
      minInterval: 1
    },
    series: _series,
    dataZoom: [
      {
        type: 'inside',
        start: 0,
        end: 100
      }
    ]
  };
}
 
export { factorLineOption };