Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMarc Delisle <marc@infomarc.info>2012-05-19 20:21:25 +0400
committerMarc Delisle <marc@infomarc.info>2012-05-19 20:21:25 +0400
commit0da8e6e474e70eff0ca622cd2491480129847ea5 (patch)
tree9b47c3ea05749b48d823ed332a2dc5fdfeebc032 /js
parentbad1b3ee7029983b99d461c381ee78986e89e523 (diff)
start handling data point updates
Diffstat (limited to 'js')
-rw-r--r--js/tbl_zoom_plot_jqplot.js73
1 files changed, 56 insertions, 17 deletions
diff --git a/js/tbl_zoom_plot_jqplot.js b/js/tbl_zoom_plot_jqplot.js
index e236ce7f07..c2ae9481b9 100644
--- a/js/tbl_zoom_plot_jqplot.js
+++ b/js/tbl_zoom_plot_jqplot.js
@@ -1,3 +1,4 @@
+// todo: change the axis
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
** @fileoverview JavaScript functions used on tbl_select.php
@@ -169,7 +170,7 @@ function includePan(currentChart) {
$(document).ready(function() {
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
var currentChart = null;
- var currentData = null;
+ var searchedDataKey = null;
var xLabel = $('#tableid_0').val();
var yLabel = $('#tableid_1').val();
var xType = $('#types_0').val();
@@ -181,7 +182,7 @@ $(document).ready(function() {
// Get query result
- var data = jQuery.parseJSON($('#querydata').html());
+ var searchedData = jQuery.parseJSON($('#querydata').html());
/**
** Input form submit on field change
@@ -263,10 +264,10 @@ $(document).ready(function() {
newValues[key] = newVal;
if (key == xLabel) {
xChange = true;
- data[currentData][xLabel] = newVal;
+ searchedData[searchedDataKey][xLabel] = newVal;
} else if (key == yLabel) {
yChange = true;
- data[currentData][yLabel] = newVal;
+ searchedData[searchedDataKey][yLabel] = newVal;
}
}
var $input = $('#fieldID_' + it);
@@ -286,12 +287,14 @@ $(document).ready(function() {
//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];
+ xCord[searchedDataKey] = 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);
+ series[0][searchedDataKey][0] = selectedRow[xLabel];
+ currentChart.series[0].data = series[0];
+ // todo: axis changing
+ currentChart.replot();
} else if (xType == 'time') {
- currentChart.series[0].data[currentData].update({
+ currentChart.series[0].data[searchedDataKey].update({
x : getTimeStamp(selectedRow[xLabel], $('#types_0').val())
});
} else {
@@ -337,12 +340,12 @@ $(document).ready(function() {
}
if (yChange) {
- yCord[currentData] = selectedRow[yLabel];
+ yCord[searchedDataKey] = selectedRow[yLabel];
if (yType == 'numeric') {
- currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] });
+ currentChart.series[0].data[searchedDataKey].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({
+ currentChart.series[0].data[searchedDataKey].update({
y : getTimeStamp(selectedRow[yLabel], $('#types_1').val())
});
} else {
@@ -386,7 +389,6 @@ $(document).ready(function() {
currentChart = PMA_createChart(currentSettings);
}
}
- currentChart.series[0].data[currentData].select();
} //End plot update
//Generate SQL query for update
@@ -422,7 +424,7 @@ $(document).ready(function() {
}
}
sql_query = sql_query.substring(0, sql_query.length - 2);
- sql_query += ' WHERE ' + PMA_urldecode(data[currentData]['where_clause']);
+ sql_query += ' WHERE ' + PMA_urldecode(searchedData[searchedDataKey]['where_clause']);
//Post SQL query to sql.php
$.post('sql.php', {
@@ -474,7 +476,7 @@ $(document).ready(function() {
* Generate plot using jqplot
*/
- if (data != null) {
+ if (searchedData != null) {
$('#zoom_search_form')
.slideToggle()
.hide();
@@ -535,15 +537,17 @@ $(document).ready(function() {
series[0] = new Array();
if (xType == 'numeric' && yType == 'numeric') {
- $.each(data, function(key, value) {
+ $.each(searchedData, function(key, value) {
var xVal = parseFloat(value[xLabel]);
var yVal = parseFloat(value[yLabel]);
series[0].push([
xVal,
yVal,
- value[dataLabel], // extra Y value for highlighter
+ // extra Y values
+ value[dataLabel], // for highlighter
// (may set an undefined value)
- value['where_clause'] // extra Y value for click on point
+ value['where_clause'], // for click on point
+ key // key from searchedData
]);
});
}
@@ -557,6 +561,41 @@ $(document).ready(function() {
$('div#querychart').bind('jqplotDataClick',
function(event, seriesIndex, pointIndex, data) {
+ searchedDataKey = data[4]; // key from searchedData (global)
+ var field_id = 4;
+ var post_params = {
+ 'ajax_request' : true,
+ 'get_data_row' : true,
+ 'db' : window.parent.db,
+ 'table' : window.parent.table,
+ 'where_clause' : data[3],
+ 'token' : window.parent.token
+ };
+
+ $.post('tbl_zoom_select.php', post_params, function(data) {
+ // Row is contained in data.row_info,
+ // now fill the displayResultForm with row values
+ for (key in data.row_info) {
+ $field = $('#fieldID_' + field_id);
+ $field_null = $('#fields_null_id_' + field_id);
+ if (data.row_info[key] == null) {
+ $field_null.attr('checked', true);
+ $field.val('');
+ } else {
+ $field_null.attr('checked', false);
+ if ($field.attr('multiple')) { // when the column is of type SET
+ $field.val(data.row_info[key].split(','));
+ } else {
+ $field.val(data.row_info[key]);
+ }
+ }
+ field_id++;
+ }
+ selectedRow = new Object();
+ selectedRow = data.row_info;
+ });
+
+ $("#dataDisplay").dialog("open");
}
);
}