The branch, master has been updated via 3bec04a9b862499c0b73db3fcdcb269e84c5fe36 (commit) via 88682495fa42000932827a928f1f688145fd3a17 (commit) via 719e5591dd407f3f1e2b13be5fbd72ad48246454 (commit) via 59e7c2e09d34e827f9f8d5412d74ac6d0c407894 (commit) via 6bfcef485c78f3e676ca765737fb5fb5f146558c (commit) from effa795c79aef8afc9891433da89cebe998f65bd (commit)
- Log ----------------------------------------------------------------- commit 3bec04a9b862499c0b73db3fcdcb269e84c5fe36 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sun Sep 18 22:27:32 2011 +0530
Always use curly braces with IF statements. Remove spaces
commit 88682495fa42000932827a928f1f688145fd3a17 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sun Sep 18 22:22:23 2011 +0530
Wrap some lone lines
commit 719e5591dd407f3f1e2b13be5fbd72ad48246454 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sun Sep 18 22:13:35 2011 +0530
Remove redundant if check
commit 59e7c2e09d34e827f9f8d5412d74ac6d0c407894 Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sun Sep 18 21:55:07 2011 +0530
These are Objects
commit 6bfcef485c78f3e676ca765737fb5fb5f146558c Author: Madhura Jayaratne madhura.cj@gmail.com Date: Sun Sep 18 20:53:53 2011 +0530
If data label is not set, do not show tooltips
-----------------------------------------------------------------------
Summary of changes: js/tbl_zoom_plot.js | 174 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 115 insertions(+), 59 deletions(-)
diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index 665a534..ce3de9d 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -92,12 +92,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 + } else { return 'text'; + } } /** ** Converts a categorical array into numeric array @@ -264,36 +266,34 @@ $(document).ready(function() { event.preventDefault();
//Find changed values by comparing form values with selectedRow Object - var newValues = new Array();//Stores the values changed from original - var sqlTypes = new Array(); + var newValues = new Object();//Stores the values changed from original + var sqlTypes = new Object(); var it = 4; var xChange = false; var yChange = false; for (key in selectedRow) { - if (key != 'where_clause') { - var oldVal = selectedRow[key]; - var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val(); - if (newVal instanceof Array) { // when the column is of type SET - newVal = $('#fieldID_' + it).map(function(){ - return $(this).val(); - }).get().join(","); - } - if (oldVal != newVal) { - selectedRow[key] = newVal; - newValues[key] = newVal; - if (key == xLabel) { - xChange = true; - data[currentData][xLabel] = newVal; - } else if (key == yLabel) { - yChange = true; - data[currentData][yLabel] = newVal; - } - } - var $input = $('#fieldID_' + it); - if ($input.hasClass('bit')) { - sqlTypes[key] = 'bit'; + var oldVal = selectedRow[key]; + var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val(); + if (newVal instanceof Array) { // when the column is of type SET + newVal = $('#fieldID_' + it).map(function(){ + return $(this).val(); + }).get().join(","); + } + if (oldVal != newVal) { + selectedRow[key] = newVal; + newValues[key] = newVal; + if (key == xLabel) { + xChange = true; + data[currentData][xLabel] = newVal; + } else if (key == yLabel) { + yChange = true; + data[currentData][yLabel] = newVal; } } + var $input = $('#fieldID_' + it); + if ($input.hasClass('bit')) { + sqlTypes[key] = 'bit'; + } it++; } //End data update
@@ -304,14 +304,17 @@ $(document).ready(function() { newSeries[0].marker = { symbol: 'circle' }; - //Logic similar to plot generation, replot only if xAxis changes or yAxis changes. Code includes a lot of checks so as to replot only when necessary + //Logic similar to plot generation, replot only if xAxis changes or yAxis changes. + //Code includes a lot of checks so as to replot only when necessary if (xChange) { xCord[currentData] = selectedRow[xLabel]; if (xType == 'numeric') { currentChart.series[0].data[currentData].update({ x : selectedRow[xLabel] }); currentChart.xAxis[0].setExtremes(Array.min(xCord) - 6, Array.max(xCord) + 6); } else if (xType == 'time') { - currentChart.series[0].data[currentData].update({ x : getTimeStamp(selectedRow[xLabel], $('#types_0').val())}); + currentChart.series[0].data[currentData].update({ + x : getTimeStamp(selectedRow[xLabel], $('#types_0').val()) + }); } else { var tempX = getCord(xCord); var tempY = getCord(yCord); @@ -322,9 +325,21 @@ $(document).ready(function() {
$.each(data, function(key, value) { if (yType != 'text') { - newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: value[yLabel], marker: {fillColor: colorCodes[i % 8]} , id: i } ); + newSeries[0].data.push({ + name: value[dataLabel], + x: tempX[0][i], + y: value[yLabel], + marker: {fillColor: colorCodes[i % 8]}, + id: i + }); } else { - newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } ); + newSeries[0].data.push({ + name: value[dataLabel], + x: tempX[0][i], + y: tempY[0][i], + marker: {fillColor: colorCodes[i % 8]}, + id: i + }); } i++; }); @@ -348,7 +363,9 @@ $(document).ready(function() { currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] }); currentChart.yAxis[0].setExtremes(Array.min(yCord) - 6, Array.max(yCord) + 6); } else if (yType == 'time') { - currentChart.series[0].data[currentData].update({ y : getTimeStamp(selectedRow[yLabel], $('#types_1').val())}); + currentChart.series[0].data[currentData].update({ + y : getTimeStamp(selectedRow[yLabel], $('#types_1').val()) + }); } else { var tempX = getCord(xCord); var tempY = getCord(yCord); @@ -359,9 +376,21 @@ $(document).ready(function() {
$.each(data, function(key, value) { if (xType != 'text' ) { - newSeries[0].data.push({ name: value[dataLabel], x: value[xLabel], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } ); + newSeries[0].data.push({ + name: value[dataLabel], + x: value[xLabel], + y: tempY[0][i], + marker: {fillColor: colorCodes[i % 8]}, + id: i + }); } else { - newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } ); + newSeries[0].data.push({ + name: value[dataLabel], + x: tempX[0][i], + y: tempY[0][i], + marker: {fillColor: colorCodes[i % 8]}, + id: i + }); } i++; }); @@ -385,32 +414,30 @@ $(document).ready(function() { if (!isEmpty(newValues)) { var sql_query = 'UPDATE `' + window.parent.table + '` SET '; for (key in newValues) { - if (key != 'where_clause') { - sql_query += '`' + key + '`=' ; - var value = newValues[key]; + sql_query += '`' + key + '`=' ; + var value = newValues[key];
- // null - if (value == null) { - sql_query += 'NULL, '; + // null + if (value == null) { + sql_query += 'NULL, ';
- // empty - } else if ($.trim(value) == '') { - sql_query += "'', "; + // empty + } else if ($.trim(value) == '') { + sql_query += "'', ";
- // other + // other + } else { + // type explicitly identified + if (sqlTypes[key] != null) { + if (sqlTypes[key] == 'bit') { + sql_query += "b'" + value + "', "; + } + // type not explicitly identified } else { - // type explicitly identified - if (sqlTypes[key] != null) { - if (sqlTypes[key] == 'bit') { - sql_query += "b'" + value + "', "; - } - // type not explicitly identified + if (!isNumeric(value)) { + sql_query += "'" + value + "', "; } else { - if (!isNumeric(value)) { - sql_query += "'" + value + "', "; - } else { - sql_query += value + ', '; - } + sql_query += value + ', '; } } } @@ -553,6 +580,11 @@ $(document).ready(function() { } };
+ // If data label is not set, do not show tooltips + if (dataLabel == '') { + currentSettings.tooltip.enabled = false; + } + $('#resizer').resizable({ resize: function() { currentChart.setSize( @@ -581,7 +613,13 @@ $(document).ready(function() { $.each(data, function(key, value) { var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel], $('#types_0').val()); var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel], $('#types_1').val()); - series[0].data.push({ name: value[dataLabel], x: xVal, y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } ); + series[0].data.push({ + name: value[dataLabel], + x: xVal, + y: yVal, + marker: {fillColor: colorCodes[it % 8]}, + id: it + }); xCord.push(value[xLabel]); yCord.push(value[yLabel]); it++; @@ -612,7 +650,13 @@ $(document).ready(function() { tempX = getCord(xCord); $.each(data, function(key, value) { var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel], $('#types_1').val()); - series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } ); + series[0].data.push({ + name: value[dataLabel], + x: tempX[0][it], + y: yVal, + marker: {fillColor: colorCodes[it % 8]}, + id: it + }); it++; });
@@ -645,7 +689,13 @@ $(document).ready(function() { tempY = getCord(yCord); $.each(data, function(key, value) { var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel], $('#types_0').val()); - series[0].data.push({ name: value[dataLabel], y: tempY[0][it], x: xVal, marker: {fillColor: colorCodes[it % 8]} , id: it } ); + series[0].data.push({ + name: value[dataLabel], + y: tempY[0][it], + x: xVal, + marker: {fillColor: colorCodes[it % 8]}, + id: it + }); it++; }); if (xType == 'numeric') { @@ -677,7 +727,13 @@ $(document).ready(function() { tempX = getCord(xCord); tempY = getCord(yCord); $.each(data, function(key, value) { - series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: tempY[0][it], marker: {fillColor: colorCodes[it % 8]} , id: it } ); + series[0].data.push({ + name: value[dataLabel], + x: tempX[0][it], + y: tempY[0][it], + marker: {fillColor: colorCodes[it % 8]}, + id: it + }); it++; }); currentSettings.xAxis.labels = {
hooks/post-receive