-
Notifications
You must be signed in to change notification settings - Fork 1
/
datacolor.js
166 lines (139 loc) · 3.51 KB
/
datacolor.js
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
function red(data) {return('rgba(255, 26, 104,' + ' ' + String(data) + ')')};
function orange(data) {return('rgba(255, 159, 64,' + ' ' + String(data) + ')')};
function blue(data) {return('rgba(54, 162, 235,' + ' ' + String(data) + ')')};
function green(data) {return('rgba(75, 192, 192,' + ' ' + String(data) + ')')};
function lightpurple(data) {return('rgba(153, 102, 255,' + ' ' + String(data) + ')')};
function bluepurple(data) {return('rgba(0, 0, 255,' + ' ' + String(data) + ')')};
function purple(data) {return('rgba(58, 51, 255,' + ' ' + String(data) + ')')};
function two(data){return([blue(data), green(data)])}
function three(data){return([blue(data), green(data), lightpurple(data)])}
function four(data){return([blue(data), green(data), lightpurple(data), bluepurple(data)])}
function five(data){return([red(data), blue(data), green(data), lightpurple(data), bluepurple(data)])}
function six(data){return([red(data), blue(data), green(data), purple(data), lightpurple(data), bluepurple(data)])}
function seven(data){return([red(data), orange(data), blue(data), green(data), purple(data), lightpurple(data), bluepurple(data)])}
let not, liste;
let same = ['H2', 'LPG', 'CH4', 'CO', 'Alcohol', 'Air'];
function earth(data , color){
switch(data){
case 2:
liste = [toplam1, toplam2];
return two(color)
break;
case 3:
liste = [toplam1, toplam2, toplam3];
return three(color)
break;
case 4:
liste = [toplam1, toplam2, toplam3, toplam4];
return four(color)
break;
case 5:
liste = [toplam1, toplam2, toplam3, toplam4, toplam5];
return five(color)
break;
case 6:
liste = [toplam1, toplam2, toplam3, toplam4, toplam5, toplam6];
return six(color)
break;
case 7:
liste = [toplam1, toplam2, toplam3, toplam4, toplam5, toplam6, toplam7];
return seven(color)
break;
default:
liste = [toplam1, toplam2, toplam3, toplam4, toplam5, toplam6, toplam7];
return seven(color)
break;
}
}
function mylist(){
switch(toplam8){
case 1:
not = 'MQ-135';
return ['CO', 'Alcohol', 'CO2', 'Toluen', 'NH4', 'Aceton', 'Air']
break;
case 2:
not = 'MQ-2';
return ['H2', 'LPG', 'CO', 'Alcohol', 'Propane', 'CH4', 'Smoke']
break;
case 3:
not = 'MQ-3';
return ['LPG', 'CH4', 'CO', 'Alcohol', 'Benzene', 'Hexane', 'Air']
break;
case 4:
not = 'MQ-4';
return ['H2', 'LPG', 'CH4', 'CO', 'Alcohol', 'Smoke', 'Air']
break;
case 5:
not = 'MQ-5';
return same
break;
case 6:
not = 'MQ-6';
return same
break;
case 7:
not = 'MQ-7';
return same
break;
case 8:
not = 'MQ-8';
return same
break;
case 9:
not = 'MQ-9';
return ['LPG', 'CH4', 'CO', 'Air']
break;
case 10:
not = 'MQ131';
return ['NOx', 'CL2', 'O3', 'Air']
break;
case 11:
not = 'MQ-136';
return ['H2S', 'NH4', 'CO', 'Air']
break;
case 12:
not = 'MQ-137';
return ['CO', 'Ethanol', 'NH3', 'Air']
break;
case 13:
not = 'MQ303A';
return ['Isobutane', 'Hydrogen', 'Ethanol', 'Air']
break;
case 14:
not = 'MQ307A';
return ['CO', 'H2']
break;
case 15:
not = 'MQ309A';
return ['H2', 'CH4', 'CO', 'Alcohol', 'Air']
break;
default:
not = 'MQ-135';
return ['CO', 'Alcohol', 'CO2', 'Toluen', 'NH4', 'Aceton', 'Air']
break;
}
}
let bl = mylist().length;
function hello(dot){
return{
type: dot,
data : {
labels: mylist(),
datasets: [{
label: not,
backgroundColor: earth(bl,0.2),
data: liste,
borderColor: earth(bl,1),
borderWidth: 1
}]
},
options: {
indexAxis: 'y',
scales: {
y: {
beginAtZero: true
}
}
}
}
}