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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
| /*
| * @Description:
| * @Version: 1.0
| * @Author: yangsx
| * @Date: 2019-11-29 09:42:21
| * @LastEditors: yangsx
| * @LastEditTime: 2019-12-10 14:47:11
| */
|
| var seChart = {
| echartsTEMP: echarts.init(document.getElementById("echartsTEMP")),
| echartsCOND: echarts.init(document.getElementById("echartsCOND")),
| echartsPH: echarts.init(document.getElementById("echartsPH")),
| echartsVWC: echarts.init(document.getElementById("echartsVWC"))
| };
|
| /**
| * @description:
| * @param {type}
| * @return:
| * @author: yangsx
| */
| function getOption(echartsX, echartsY, code, unit, minthreshold, maxthreshold) {
| var option = {
| // backgroundColor: "#050d1999",
| tooltip: {
| //鼠标悬浮弹出提示框
| trigger: "axis", //提示框弹出的触发时间,折线图和柱状图为axis
| formatter: "{a} <br/>{b} <br/> {c} " + unit //提示框提示的信息,{a}series内的名字,{b}为块状的名字,{c}为数值
| },
| grid: {
| //统计图距离边缘的距离
| top: "8%",
| left: "10%",
| right: "10%",
| bottom: "18%"
| },
| xAxis: [
| {
| //x轴
| type: "category", //数据类型为不连续数据
| boundaryGap: false, //坐标轴两边是否留白
| axisLine: {
| //坐标轴轴线相关设置。数学上的x轴
| show: true,
| lineStyle: {
| color: "#233e64" //x轴颜色
| }
| },
| axisLabel: {
| //坐标轴刻度标签的相关设置
| textStyle: {
| color: "#6a9cd5"
| }
| },
| axisTick: { show: true }, //刻度点数轴
| data: echartsX
| }
| ],
| yAxis: [
| {
| //y轴的相关设置
| type: "value", //y轴数据类型为连续的数据
| // min: 0,//y轴上的刻度最小值
| // max:140,//y轴上的刻度最大值
| splitNumber: 7, //y轴上的刻度段数
| splitLine: {
| //y轴上的y轴线条相关设置
| show: true,
| lineStyle: {
| color: "#233e64"
| }
| },
| axisLine: {
| //y轴的相关设置
| show: true,
| lineStyle: {
| color: "#233e64" //y轴颜色
| }
| },
| axisLabel: {
| //y轴的标签相关设置
| formatter: "{value}",
| textStyle: {
| color: "#6a9cd5"
| }
| },
| axisTick: { show: true } //刻度点数轴
| }
| ],
| visualMap: {
| top: 0,
| right: 15,
| show: false,
| pieces: [
| {
| max: Number(minthreshold),
| color: "rgba(236,19,21, 0.6)"
| },
| {
| min: Number(maxthreshold),
| color: "rgba(236,19,21, 0.6)"
| }
| ],
| outOfRange: {
| color: "rgba(61,234,255, 0.6)"
| }
| },
| series: [
| {
| name: code,
| type: "line", //统计图类型为折线图
| smooth: true, //是否平滑曲线显示
| symbolSize: 0, //数据点的大小,[0,0]//b表示宽度和高度
| // lineStyle: {
| // //线条的相关设置
| // normal: {
| // color: "#3deaff" // 线条颜色
| // }
| // },
| // areaStyle: {
| // //区域填充样式
| // normal: {
| // //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。
| // shadowColor: "rgba(53,142,215, 0.9)", //阴影颜色
| // shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
| // }
| // },
| data: echartsY
| }
| ]
| };
| return option;
| }
|
|