- Timestamp:
- 05/25/13 00:48:17 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Module/calendar.php
r16222 r16223 90 90 var DataVal = []; 91 91 var source=['Mrk 421']; 92 93 f or(var i=0; i<source.length;i++)92 var lines = []; 93 function LoadData() 94 94 { 95 if(window.XMLHttpRequest)95 for(var i=0; i<source.length;i++) 96 96 { 97 xml=new XMLHttpRequest(); 97 if(window.XMLHttpRequest) 98 { 99 xml=new XMLHttpRequest(); 100 } 101 else 102 { 103 xml=new ActiveXObject("Microsoft.XMLHTTP"); 104 } 105 xml.onreadystatechange = function() 106 { 107 if(xml.readyState==4 && xml.status ==200) 108 { 109 110 var lines[i]=xml.responseText.split("\n"); 111 112 113 } 114 } 115 xml.open("GET","http://www.fact-project.org/smartfact/index.php?source="+escape(source[i])+"&time="+year+"-"+month+"-"+day,true); 116 xml.send(); 98 117 } 99 else 118 Charts(lines[i]); 119 } 120 LoadData(); 121 function Charts(line) 122 { 123 for(var row=0;row<line.length;row++) 100 124 { 101 xml=new ActiveXObject("Microsoft.XMLHTTP"); 125 var splitted=line[row].split(','); 126 Time1[row]=splitted[0]; 127 for(var SplittedTime=0;SplittedTime<Time1.length;SplittedTime++) 128 { 129 var SplitTime=Time1[SplittedTime].split(':'); 130 TimeColon[SplittedTime]=SplitTime[0]; 131 MinTime[SplittedTime]=(parseInt(SplitTime[1]/60*100)||parseInt("0")); 132 for(var TimeT=0;TimeT<TimeColon.length;TimeT++) 133 { 134 var SplittedT=TimeColon[TimeT].split('T'); 135 HourTime[TimeT]=(parseFloat(SplittedT[1])||parseInt('0')); 136 } 137 } 138 DataVal[row]=(parseFloat(splitted[4])||parseInt('0')); 139 //document.getElementById('data').innerHTML=DataValue; 140 141 for(var Data=0; Data<DataVal.length;Data++) 142 { 143 if(DataVal[Data]==0) 144 { 145 146 } 147 else 148 DataValue.push(parseFloat(DataVal[Data])); 149 } 150 151 152 for(var ConTime=1;ConTime<HourTime.length-1;ConTime++) 153 { 154 if(HourTime[ConTime]==0) 155 { 156 if(MinTime[ConTime]==8) 157 { 158 Time.push(HourTime[ConTime]+24+'.'+'.08'); 159 } 160 else 161 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 162 } 163 else if(HourTime[ConTime]==1) 164 { 165 if(MinTime[ConTime]==8) 166 { 167 Time.push(HourTime[ConTime]+24+'.'+'.08'); 168 } 169 else 170 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 171 } 172 else if(HourTime[ConTime]==2) 173 { 174 if(MinTime[ConTime]==8) 175 { 176 Time.push(HourTime[ConTime]+24+'.'+'.08'); 177 } 178 else 179 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 180 } 181 else if(HourTime[ConTime]==3) 182 { 183 if(MinTime[ConTime]==8) 184 { 185 Time.push(HourTime[ConTime]+24+'.'+'.08'); 186 } 187 else 188 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 189 } 190 else if(HourTime[ConTime]==4) 191 { 192 if(MinTime[ConTime]==8) 193 { 194 Time.push(HourTime[ConTime]+24+'.'+'.08'); 195 } 196 else 197 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 198 } 199 else if(HourTime[ConTime]==5) 200 { 201 if(MinTime[ConTime]==8) 202 { 203 Time.push(HourTime[ConTime]+24+'.'+'.08'); 204 } 205 else 206 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 207 } 208 else if(HourTime[ConTime]==6) 209 { 210 if(MinTime[ConTime]==8) 211 { 212 Time.push(HourTime[ConTime]+24+'.'+'.08'); 213 } 214 else 215 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 216 } 217 else 218 Time.push(HourTime[ConTime]+'.'+MinTime[ConTime]); 219 220 } 221 222 //GrapData(Data,Time); 223 102 224 } 103 xml.onreadystatechange = function() 225 var options = { 226 chart: { 227 renderTo: 'container' /* display to div Graph*/ 228 229 }, 230 231 xAxis: { 232 categories:["12PM","1PM","2PM","3PM","4PM","5PM","6PM","7PM","8PM","9PM","10PM","11PM","12AM","1AM","2AM","3AM","4AM","5AM","6AM","7AM","8AM","9AM","10AM","12PM"] 233 }, 234 series:[], /* array of Data */ 235 236 remove:function() 237 { 238 return false; 239 }, 240 241 exporting: { /*--------------------*/ 242 buttons: { /* */ 243 exportButton: { /* Export */ 244 menuItems: null, /* to */ 245 onclick: function() { /* PNG.file */ 246 this.exportChart(); /*--------------------*/ 247 } 248 } 249 } 250 }, 251 plotOptions : { 252 253 series : { 254 lineWidth: 3, 255 256 marker : { 257 enabled:false 258 } 259 } 260 } 261 }; 262 var chart=new Highcharts.Chart(options); 263 for(var src=0;src<source.length;src++) 104 264 { 105 if(xml.readyState==4 && xml.status ==200) 106 { 107 function LoadData() 108 { 109 var lines=xml.responseText.split("\n"); 110 Charts(lines); 111 } 112 113 LoadData(); 114 function Charts(line) 115 { 116 for(var row=0;row<line.length;row++) 117 { 118 var splitted=line[row].split(','); 119 Time1[row]=splitted[0]; 120 for(var SplittedTime=0;SplittedTime<Time1.length;SplittedTime++) 121 { 122 var SplitTime=Time1[SplittedTime].split(':'); 123 TimeColon[SplittedTime]=SplitTime[0]; 124 MinTime[SplittedTime]=(parseInt(SplitTime[1]/60*100)||parseInt("0")); 125 for(var TimeT=0;TimeT<TimeColon.length;TimeT++) 126 { 127 var SplittedT=TimeColon[TimeT].split('T'); 128 HourTime[TimeT]=(parseFloat(SplittedT[1])||parseInt('0')); 129 } 130 } 131 DataVal[row]=(parseFloat(splitted[4])||parseInt('0')); 132 //document.getElementById('data').innerHTML=DataValue; 133 134 for(var Data=0; Data<DataVal.length;Data++) 135 { 136 if(DataVal[Data]==0) 137 { 138 139 } 140 else 141 DataValue.push(parseFloat(DataVal[Data])); 142 } 143 144 145 for(var ConTime=1;ConTime<HourTime.length-1;ConTime++) 146 { 147 if(HourTime[ConTime]==0) 148 { 149 if(MinTime[ConTime]==8) 150 { 151 Time.push(HourTime[ConTime]+24+'.'+'.08'); 152 } 153 else 154 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 155 } 156 else if(HourTime[ConTime]==1) 157 { 158 if(MinTime[ConTime]==8) 159 { 160 Time.push(HourTime[ConTime]+24+'.'+'.08'); 161 } 162 else 163 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 164 } 165 else if(HourTime[ConTime]==2) 166 { 167 if(MinTime[ConTime]==8) 168 { 169 Time.push(HourTime[ConTime]+24+'.'+'.08'); 170 } 171 else 172 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 173 } 174 else if(HourTime[ConTime]==3) 175 { 176 if(MinTime[ConTime]==8) 177 { 178 Time.push(HourTime[ConTime]+24+'.'+'.08'); 179 } 180 else 181 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 182 } 183 else if(HourTime[ConTime]==4) 184 { 185 if(MinTime[ConTime]==8) 186 { 187 Time.push(HourTime[ConTime]+24+'.'+'.08'); 188 } 189 else 190 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 191 } 192 else if(HourTime[ConTime]==5) 193 { 194 if(MinTime[ConTime]==8) 195 { 196 Time.push(HourTime[ConTime]+24+'.'+'.08'); 197 } 198 else 199 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 200 } 201 else if(HourTime[ConTime]==6) 202 { 203 if(MinTime[ConTime]==8) 204 { 205 Time.push(HourTime[ConTime]+24+'.'+'.08'); 206 } 207 else 208 Time.push(HourTime[ConTime]+24+'.'+MinTime[ConTime]); 209 } 210 else 211 Time.push(HourTime[ConTime]+'.'+MinTime[ConTime]); 212 213 } 214 215 //GrapData(Data,Time); 216 217 } 218 var options = { 219 chart: { 220 renderTo: 'container' /* display to div Graph*/ 221 222 }, 223 224 xAxis: { 225 categories:["12PM","1PM","2PM","3PM","4PM","5PM","6PM","7PM","8PM","9PM","10PM","11PM","12AM","1AM","2AM","3AM","4AM","5AM","6AM","7AM","8AM","9AM","10AM","12PM"] 226 }, 227 series:[], /* array of Data */ 228 229 remove:function() 230 { 231 return false; 232 }, 233 234 exporting: { /*--------------------*/ 235 buttons: { /* */ 236 exportButton: { /* Export */ 237 menuItems: null, /* to */ 238 onclick: function() { /* PNG.file */ 239 this.exportChart(); /*--------------------*/ 240 } 241 } 242 } 243 }, 244 plotOptions : { 245 246 series : { 247 lineWidth: 3, 248 249 marker : { 250 enabled:false 251 } 252 } 253 } 254 }; 255 var chart=new Highcharts.Chart(options); 256 for(var src=0;src<i;src++) 257 { 258 chart.addSeries({name:source[src], data:[]}); // created a series of data and add name of displayed source 259 for(var DataCnt=0;DataCnt<DataValue.length;DataCnt++) 260 { 261 262 chart.series[src].addPoint({ // series[0] means index of zero in data; 263 x:Time[DataCnt], // Time 264 y:DataValue[DataCnt] // Value 265 }) 266 //document.getElementById('data').innerHTML=Time[src][DataCnt]; 267 268 } 269 270 } 271 return Charts; 272 } 273 Charts(); 274 275 276 } 265 chart.addSeries({name:source[src], data:[]}); // created a series of data and add name of displayed source 266 for(var DataCnt=0;DataCnt<DataValue[src].length;DataCnt++) 267 { 268 269 chart.series[src].addPoint({ // series[0] means index of zero in data; 270 x:Time[src][DataCnt], // Time 271 y:DataValue[src][DataCnt] // Value 272 }) 273 //document.getElementById('data').innerHTML=Time[src][DataCnt]; 274 275 } 276 277 277 } 278 xml.open("GET","http://www.fact-project.org/smartfact/index.php?source="+escape(source[i])+"&time="+year+"-"+month+"-"+day,true); 279 xml.send(); 280 281 278 return Charts; 282 279 } 280 Charts(); 283 281 //Charts(); 284 282 $('#Graph').load('chart.php?day='+day+"&month="+month+"&year="+year);
Note:
See TracChangeset
for help on using the changeset viewer.