diff options
author | Michal Čihař <mcihar@suse.cz> | 2013-07-30 16:27:12 +0400 |
---|---|---|
committer | Michal Čihař <mcihar@suse.cz> | 2013-07-30 16:36:43 +0400 |
commit | 1bb39b0effd8945713394bcb46da9ec9260c96f8 (patch) | |
tree | 4736f5758aff497d57348d51a9e33289b86726ce /js/tbl_zoom_plot_jqplot.js | |
parent | 43988b3201308f09ff58300ab94fc6767d90ba83 (diff) |
Various coding style improvements
Diffstat (limited to 'js/tbl_zoom_plot_jqplot.js')
-rw-r--r-- | js/tbl_zoom_plot_jqplot.js | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/js/tbl_zoom_plot_jqplot.js b/js/tbl_zoom_plot_jqplot.js index fe7dcf35f3..7b37c7bfbd 100644 --- a/js/tbl_zoom_plot_jqplot.js +++ b/js/tbl_zoom_plot_jqplot.js @@ -1,4 +1,4 @@ -// todo: change the axis +// TODO: change the axis /* vim: set expandtab sw=4 ts=4 sts=4: */ /** ** @fileoverview JavaScript functions used on tbl_select.php @@ -57,7 +57,9 @@ function isEmpty(obj) { ** @param type Sring Field type(datetime/timestamp/time/date) **/ function getTimeStamp(val, type) { - if (type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) { + if (type.toString().search(/datetime/i) != -1 || + type.toString().search(/timestamp/i) != -1 + ) { return $.datepicker.parseDateTime('yy-mm-dd', 'HH:mm:ss', val); } else if (type.toString().search(/time/i) != -1) { @@ -73,10 +75,14 @@ function getTimeStamp(val, type) { ** @param field: field type (as in database structure) **/ function getType(field) { - if (field.toString().search(/int/i) != -1 || field.toString().search(/decimal/i) != -1 - || field.toString().search(/year/i) != -1) { + if (field.toString().search(/int/i) != -1 || + field.toString().search(/decimal/i) != -1 || + field.toString().search(/year/i) != -1 + ) { return 'numeric'; - } else if (field.toString().search(/time/i) != -1 || field.toString().search(/date/i) != -1) { + } else if (field.toString().search(/time/i) != -1 || + field.toString().search(/date/i) != -1 + ) { return 'time'; } else { return 'text'; @@ -320,10 +326,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () { series[0][searchedDataKey][0] = getTimeStamp(selectedRow[xLabel], $('#types_0').val()); } else { - // todo: text values + // TODO: text values } currentChart.series[0].data = series[0]; - // todo: axis changing + // TODO: axis changing currentChart.replot(); } @@ -336,10 +342,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () { series[0][searchedDataKey][1] = getTimeStamp(selectedRow[yLabel], $('#types_1').val()); } else { - // todo: text values + // TODO: text values } currentChart.series[0].data = series[0]; - // todo: axis changing + // TODO: axis changing currentChart.replot(); } } //End plot update @@ -448,6 +454,9 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () { var xMin; // xAxis extreme min var yMax; // yAxis extreme max var yMin; // yAxis extreme min + var xVal; + var yVal; + var format; var options = { series: [ @@ -497,11 +506,10 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () { if (xType == 'time') { var originalXType = $('#types_0').val(); - var format; if (originalXType == 'date') { format = '%Y-%m-%d'; } - // todo: does not seem to work + // TODO: does not seem to work //else if (originalXType == 'time') { // format = '%H:%M'; //} else { @@ -516,7 +524,6 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () { } if (yType == 'time') { var originalYType = $('#types_1').val(); - var format; if (originalYType == 'date') { format = '%Y-%m-%d'; } @@ -530,16 +537,16 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () { $.each(searchedData, function (key, value) { if (xType == 'numeric') { - var xVal = parseFloat(value[xLabel]); + xVal = parseFloat(value[xLabel]); } if (xType == 'time') { - var xVal = getTimeStamp(value[xLabel], originalXType); + xVal = getTimeStamp(value[xLabel], originalXType); } if (yType == 'numeric') { - var yVal = parseFloat(value[yLabel]); + yVal = parseFloat(value[yLabel]); } if (yType == 'time') { - var yVal = getTimeStamp(value[yLabel], originalYType); + yVal = getTimeStamp(value[yLabel], originalYType); } series[0].push([ xVal, |