Changeset 16162
- Timestamp:
- 05/24/13 17:56:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Module/calendar.php
r16161 r16162 77 77 var year =this.selection.print("%Y").join("\n"); 78 78 var xml; 79 var Time = [[]]; 80 var DataValue = [[]]; 79 81 var Time1 = []; 80 82 var TimeColon = []; … … 120 122 } 121 123 }; 122 var Time = [[]]; 123 var DataValue = [[]]; 124 for(var i=0; i<source.length;i++) 124 function loaddata() 125 125 { 126 127 if(window.XMLHttpRequest) 126 for(var i=0; i<source.length;i++) 128 127 { 129 xml=new XMLHttpRequest(); 128 129 if(window.XMLHttpRequest) 130 { 131 xml=new XMLHttpRequest(); 132 } 133 else 134 { 135 xml=new ActiveXObject("Microsoft.XMLHTTP"); 136 } 137 xml.onreadystatechange = function() 138 { 139 if(xml.readyState==4 && xml.status ==200) 140 { 141 var lines=xml.responseText.split("\n"); 142 for(var row=0;row<lines.length;row++) 143 { 144 var splitted=lines[row].split(','); 145 Time1[row]=splitted[0]; 146 for(var SplittedTime=0;SplittedTime<Time1.length;SplittedTime++) 147 { 148 var SplitTime=Time1[SplittedTime].split(':'); 149 TimeColon[SplittedTime]=SplitTime[0]; 150 MinTime[SplittedTime]=(parseInt(SplitTime[1]/60*100)||parseInt("0")); 151 for(var TimeT=0;TimeT<TimeColon.length;TimeT++) 152 { 153 var SplittedT=TimeColon[TimeT].split('T'); 154 HourTime[TimeT]=(parseFloat(SplittedT[1])||parseInt('0')); 155 } 156 } 157 DataVal[row]=(parseFloat(splitted[4])||parseInt('0')); 158 //document.getElementById('data').innerHTML=DataValue; 159 160 for(var Data=0; Data<DataVal.length;Data++) 161 { 162 if(DataVal[Data]==0) 163 { 164 165 } 166 else 167 DataValue.push(parseFloat(DataVal[Data])); 168 } 169 170 171 for(var ConTime=1;ConTime<HourTime.length-1;ConTime++) 172 { 173 if(HourTime[ConTime]==0) 174 { 175 if(MinTime[ConTime]==8) 176 { 177 Time.push(HourTime[ConTime]+24+'.'+'.08'); 178 } 179 else 180 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 181 } 182 else if(HourTime[ConTime]==1) 183 { 184 if(MinTime[ConTime]==8) 185 { 186 Time.push(HourTime[ConTime]+24+'.'+'.08'); 187 } 188 else 189 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 190 } 191 else if(HourTime[ConTime]==2) 192 { 193 if(MinTime[ConTime]==8) 194 { 195 Time.push(HourTime[ConTime]+24+'.'+'.08'); 196 } 197 else 198 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 199 } 200 else if(HourTime[ConTime]==3) 201 { 202 if(MinTime[ConTime]==8) 203 { 204 Time.push(HourTime[ConTime]+24+'.'+'.08'); 205 } 206 else 207 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 208 } 209 else if(HourTime[ConTime]==4) 210 { 211 if(MinTime[ConTime]==8) 212 { 213 Time.push(HourTime[ConTime]+24+'.'+'.08'); 214 } 215 else 216 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 217 } 218 else if(HourTime[ConTime]==5) 219 { 220 if(MinTime[ConTime]==8) 221 { 222 Time.push(HourTime[ConTime]+24+'.'+'.08'); 223 } 224 else 225 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 226 } 227 else if(HourTime[ConTime]==6) 228 { 229 if(MinTime[ConTime]==8) 230 { 231 Time.push(HourTime[ConTime]+24+'.'+'.08'); 232 } 233 else 234 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 235 } 236 else 237 Time.push(HourTime[ConTime]+'.'+MinTime[ConTime]); 238 239 } 240 241 //GrapData(Data,Time); 242 243 } 244 245 246 } 247 } 248 xml.open("GET","http://www.fact-project.org/smartfact/index.php?source="+escape(source[i])+"&time="+year+"-"+month+"-"+day,true); 249 xml.send(); 250 251 130 252 } 131 else 253 loadGraph(DataValue,Time); 254 } 255 function loadGraph(var x,var y) 256 { 257 var chart = new Highcharts.Chart(options); 258 for(var src=0;src<i;src++) 132 259 { 133 xml=new ActiveXObject("Microsoft.XMLHTTP"); 260 chart.addSeries({name:source[src], data:[]}); // created a series of data and add name of displayed source 261 for(var DataCnt=0;DataCnt<x[src].length;DataCnt++) 262 { 263 264 chart.series[src].addPoint({ // series[0] means index of zero in data; 265 x:x[src][DataCnt], // Time 266 y:y[src][DataCnt] // Value 267 }) 268 document.getElementById('data').innerHTML=x; 269 270 } 271 134 272 } 135 xml.onreadystatechange = function() 136 { 137 if(xml.readyState==4 && xml.status ==200) 138 { 139 var lines=xml.responseText.split("\n"); 140 for(var row=0;row<lines.length;row++) 141 { 142 var splitted=lines[row].split(','); 143 Time1[row]=splitted[0]; 144 for(var SplittedTime=0;SplittedTime<Time1.length;SplittedTime++) 145 { 146 var SplitTime=Time1[SplittedTime].split(':'); 147 TimeColon[SplittedTime]=SplitTime[0]; 148 MinTime[SplittedTime]=(parseInt(SplitTime[1]/60*100)||parseInt("0")); 149 for(var TimeT=0;TimeT<TimeColon.length;TimeT++) 150 { 151 var SplittedT=TimeColon[TimeT].split('T'); 152 HourTime[TimeT]=(parseFloat(SplittedT[1])||parseInt('0')); 153 } 154 } 155 DataVal[row]=(parseFloat(splitted[4])||parseInt('0')); 156 //document.getElementById('data').innerHTML=DataValue; 157 158 for(var Data=0; Data<DataVal.length;Data++) 159 { 160 if(DataVal[Data]==0) 161 { 162 163 } 164 else 165 DataValue.push(parseFloat(DataVal[Data])); 166 } 167 168 169 for(var ConTime=1;ConTime<HourTime.length-1;ConTime++) 170 { 171 if(HourTime[ConTime]==0) 172 { 173 if(MinTime[ConTime]==8) 174 { 175 Time.push(HourTime[ConTime]+24+'.'+'.08'); 176 } 177 else 178 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 179 } 180 else if(HourTime[ConTime]==1) 181 { 182 if(MinTime[ConTime]==8) 183 { 184 Time.push(HourTime[ConTime]+24+'.'+'.08'); 185 } 186 else 187 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 188 } 189 else if(HourTime[ConTime]==2) 190 { 191 if(MinTime[ConTime]==8) 192 { 193 Time.push(HourTime[ConTime]+24+'.'+'.08'); 194 } 195 else 196 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 197 } 198 else if(HourTime[ConTime]==3) 199 { 200 if(MinTime[ConTime]==8) 201 { 202 Time.push(HourTime[ConTime]+24+'.'+'.08'); 203 } 204 else 205 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 206 } 207 else if(HourTime[ConTime]==4) 208 { 209 if(MinTime[ConTime]==8) 210 { 211 Time.push(HourTime[ConTime]+24+'.'+'.08'); 212 } 213 else 214 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 215 } 216 else if(HourTime[ConTime]==5) 217 { 218 if(MinTime[ConTime]==8) 219 { 220 Time.push(HourTime[ConTime]+24+'.'+'.08'); 221 } 222 else 223 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 224 } 225 else if(HourTime[ConTime]==6) 226 { 227 if(MinTime[ConTime]==8) 228 { 229 Time.push(HourTime[ConTime]+24+'.'+'.08'); 230 } 231 else 232 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 233 } 234 else 235 Time.push(HourTime[ConTime]+'.'+MinTime[ConTime]); 236 237 } 238 239 //GrapData(Data,Time); 240 241 } 242 243 var chart = new Highcharts.Chart(options); 244 for(var src=0;src<i;src++) 245 { 246 chart.addSeries({name:source[src], data:[]}); // created a series of data and add name of displayed source 247 for(var DataCnt=0;DataCnt<DataValue[src].length;DataCnt++) 248 { 249 250 chart.series[src].addPoint({ // series[0] means index of zero in data; 251 x:Time[src][DataCnt], // Time 252 y:DataValue[src][DataCnt] // Value 253 }) 254 document.getElementById('data').innerHTML=Time[DataCnt]; 255 256 } 257 258 } 259 260 261 } 262 } 263 xml.open("GET","http://www.fact-project.org/smartfact/index.php?source="+escape(source[i])+"&time="+year+"-"+month+"-"+day,true); 264 xml.send(); 265 266 273 267 274 } 268 275 $('#Graph').load('chart.php?day='+day+"&month="+month+"&year="+year);
Note:
See TracChangeset
for help on using the changeset viewer.