moved events to extra function

This commit is contained in:
Steffen Vogel 2010-10-05 13:29:51 +02:00
parent 18be676732
commit 47ab29d192
2 changed files with 32 additions and 28 deletions

View file

@ -70,7 +70,7 @@ vz.initInterface = function() {
vz.uuids.add($('#addUUID input[type=text]').val());
$('#addUUID').dialog('close');
vz.entities.load();
})
});
// bind plot actions
$('#move input').click(vz.handleControls);
@ -102,6 +102,36 @@ vz.initInterface = function() {
});
};
vz.bindEvents = function() {
// handle zooming & panning
$('#plot')
.bind("plotselected", function (event, ranges) {
vz.from = Math.floor(ranges.xaxis.from);
vz.to = Math.ceil(ranges.xaxis.to);
vz.options.plot.yaxis.min = 0;
vz.options.plot.yaxis.max = null; // autoscaling
vz.data.load();
})
/*.bind('plotpan', function (event, plot) {
var axes = vz.plot.getAxes();
vz.from = Math.floor(axes.xaxis.min);
vz.to = Math.ceil(axes.xaxis.max);
vz.options.plot.yaxis.min = axes.yaxis.min;
vz.options.plot.yaxis.max = axes.yaxis.max;
})*/
/*.bind('mouseup', function(event) {
loadData();
})*/
.bind('plotzoom', function (event, plot) {
var axes = vz.plot.getAxes();
vz.from = Math.floor(axes.xaxis.min);
vz.to = Math.ceil(axes.xaxis.max);
vz.options.plot.yaxis.min = axes.yaxis.min;
vz.options.plot.yaxis.max = axes.yaxis.max;
vz.data.load();
});
};
/**
* Refresh plot with new data
*/

View file

@ -114,33 +114,7 @@ $(document).ready(function() {
// start auto refresh timer
window.setInterval(vz.refresh, 5000);
// handle zooming & panning
$('#plot')
.bind("plotselected", function (event, ranges) {
vz.from = Math.floor(ranges.xaxis.from);
vz.to = Math.ceil(ranges.xaxis.to);
vz.options.plot.yaxis.min = 0;
vz.options.plot.yaxis.max = null; // autoscaling
vz.data.load();
})
/*.bind('plotpan', function (event, plot) {
var axes = vz.plot.getAxes();
vz.from = Math.floor(axes.xaxis.min);
vz.to = Math.ceil(axes.xaxis.max);
vz.options.plot.yaxis.min = axes.yaxis.min;
vz.options.plot.yaxis.max = axes.yaxis.max;
})*/
.bind('plotzoom', function (event, plot) {
var axes = vz.plot.getAxes();
vz.from = Math.floor(axes.xaxis.min);
vz.to = Math.ceil(axes.xaxis.max);
vz.options.plot.yaxis.min = axes.yaxis.min;
vz.options.plot.yaxis.max = axes.yaxis.max;
vz.data.load();
})
.bind('mouseup', function(event) {
//loadData();
});
vz.bindEvents();
vz.entities.load();
});