diff --git a/frontend/javascript/functions.js b/frontend/javascript/functions.js
index 03f514d..0405e03 100644
--- a/frontend/javascript/functions.js
+++ b/frontend/javascript/functions.js
@@ -18,35 +18,6 @@
* http://www.gnu.org/copyleft/gpl.html
*/
-// return an array with timestamps of e.g.
-// 2010-05-01 00:00:00, 2010-05-01 01:00, 2010-05-01 02:00 for grouping=hour
-// between windowStart and windowEnd of json response
-function getEmptyGroupArray() {
- var empty_array = new Object();
-
- var iterator = getGroupedTimestamp(myWindowStart);
- //$('#debug').empty().append('start:'+myWindowStart+'end:'+myWindowEnd);
-
- if(myWindowStart < myWindowEnd && iterator < myWindowEnd) {
- var i=0;
- while(iterator < myWindowEnd) {
- i++;
-
- empty_array[iterator] = 0;
-
- var iteratorDate = new Date(iterator);
- //$('#debug').append('#'+i+':'+iteratorDate+'
');
- iteratorDate.setDate(iteratorDate.getDate()+1);
- // very bad bug: infinity loop for summer winter change
- if(i==750) return empty_array;
-
- iterator = iteratorDate.getTime();
- }
- }
-
- return empty_array
-}
-
function calcMyWindowStart() {
var myWindowStart = new Date(myWindowEnd);
@@ -82,6 +53,8 @@ function getGroupedTimestamp(timestamp) {
}
function loadChannelList() {
+
+
$('#debug').append('json');
// load json data
$.getJSON("../backend/index.php/data/" + myUUID + {format: 'json'});
@@ -89,6 +62,7 @@ function loadChannelList() {
}
function autoReload() {
+
// call getData if autoReload checkbox is active
if(f.autoReload.checked == true) {
myWindowEnd = getGroupedTimestamp((new Date()).getTime());
@@ -97,6 +71,7 @@ function autoReload() {
}
function moveWindow(mode) {
+
if(mode == 'last')
myWindowEnd = (new Date()).getTime();
if(mode == 'back') {
@@ -111,28 +86,36 @@ function moveWindow(mode) {
function getData() {
+
/*
- * if(f.ids.length>0) $('#loading').empty().html('
');
- * // list of channel ids, comma separated ids_parameter = "";
- *
- * if(typeof f.ids.length == 'undefined') { // only one channel
- * ids_parameter = f.ids.value; } else { // more than one channel for(i=0;i0)
+ $('#loading').empty().html('
');
+
+ // list of channel ids, comma separated
+ ids_parameter = "";
+
+ if(typeof f.ids.length == 'undefined') { // only one channel
+ ids_parameter = f.ids.value;
+ }
+ else { // more than one channel
+ for(i=0;ijson');
// load json data with given time window
- // $.getJSON("../backend/index.php/data/" + myUUID +
- // '/format/json/from/'+myWindowStart+'/to/'+myWindowEnd, function(j){
+ //$.getJSON("../backend/index.php/data/" + myUUID + '/format/json/from/'+myWindowStart+'/to/'+myWindowEnd, function(j){
$.getJSON("../backend/index.php/data/" + myUUID + '.json?from='+myWindowStart+'&to='+myWindowEnd, function(j){
data = j;
$('#debug').empty().append(data.toSource());
// then show/reload the chart
- // if(data.channels.length > 0 && data.channels[0].pulses.length > 0)
+ //if(data.channels.length > 0 && data.channels[0].pulses.length > 0)
showChart();
$('#loading').empty();
});
@@ -141,6 +124,7 @@ function getData() {
}
function showChart() {
+
var jqData = new Array();
var series_chart = new Array();
@@ -183,46 +167,3 @@ function showChart() {
chart.replot();
}
-
-function generateAxisTicks() {
- var data_grouped_time = getEmptyGroupArray();
- var ticks = new Array();
-
- for(var timestamp in data_grouped_time) {
- var time = new Date(timestamp*1000);
- ticks.push(time.getDate()+'.'+(time.getMonth()+1)+'.'+' '+time.getHours()+':00');
- }
-
- return ticks;
-}
-
-function updateTips(t) {
- tips
- .text(t)
- .addClass('ui-state-highlight');
- setTimeout(function() {
- tips.removeClass('ui-state-highlight', 1500);
- }, 500);
-}
-
-
-function checkLength(o,n,min,max) {
-
- if ( o.val().length > max || o.val().length < min ) {
- o.addClass('ui-state-error');
- updateTips("Length of " + n + " must be between "+min+" and "+max+".");
- return false;
- } else {
- return true;
- }
-}
-
-function checkRegexp(o,regexp,n) {
- if ( !( regexp.test( o.val() ) ) ) {
- o.addClass('ui-state-error');
- updateTips(n);
- return false;
- } else {
- return true;
- }
-}
\ No newline at end of file
diff --git a/frontend/javascript/script.js b/frontend/javascript/script.js
index 97b91d0..7483262 100644
--- a/frontend/javascript/script.js
+++ b/frontend/javascript/script.js
@@ -34,6 +34,8 @@ var windowGrouping = 0;
// mouse position on mousedown (x-axis)
var moveXstart = 0;
+
+
// executed on document loaded complete
// this is where it all starts...
$(document).ready(function() {
@@ -59,9 +61,9 @@ $(document).ready(function() {
window.setInterval("autoReload()",5000);
// code for adding a channel
- var uuid = $("#uuid");
- var allFields = $([]).add(uuid);
- var tips = $(".validateTips");
+ var uuid = $("#uuid"),
+ allFields = $([]).add(uuid),
+ tips = $(".validateTips");
getData();
-});
\ No newline at end of file
+});