summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Wuerthwein <fkw@ucsd.edu>2009-02-27 23:42:17 +0000
committerFrank Wuerthwein <fkw@ucsd.edu>2009-02-27 23:42:17 +0000
commit8bbf8925dbc71be788814b04ae10519f65470075 (patch)
tree33ffc81807be10677f9a5c483e3ba805be785abb
parentaaf0c323b98b9fd9d2f37d1703955447628c8e92 (diff)
Fix selection
-rw-r--r--src/lib/rrdFlot.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/rrdFlot.js b/src/lib/rrdFlot.js
index 2a0ad9a..3883e5c 100644
--- a/src/lib/rrdFlot.js
+++ b/src/lib/rrdFlot.js
@@ -232,11 +232,20 @@ rrdFlot.prototype.bindFlotGraph = function(flot_obj) {
var graph_options = {
legend: {show:true, position:"nw",noColumns:3},
lines: {show:true},
- xaxis: { mode: "time", min:flot_obj.min, max:flot_obj.max },
+ xaxis: { mode: "time" },
yaxis: { autoscaleMargin: 0.20},
selection: { mode: "x" },
};
+ if (this.selection_range.isSet()) {
+ var selection_range=this.selection_range.getFlotRanges();
+ graph_options.xaxis.min=selection_range.xaxis.from;
+ graph_options.xaxis.max=selection_range.xaxis.to;
+ } else {
+ graph_options.xaxis.min=flot_obj.min;
+ graph_options.xaxis.max=flot_obj.max;
+ }
+
if (this.graph_options!=null) {
if (this.graph_options.legend!=null) {
if (this.graph_options.legend.position!=null) {
@@ -276,6 +285,8 @@ rrdFlot.prototype.bindFlotGraph = function(flot_obj) {
$(graph_jq_id).bind("plotselected", function (event, ranges) {
// do the zooming
rf_this.selection_range.setFromFlotRanges(ranges);
+ graph_options.xaxis.min=ranges.xaxis.from;
+ graph_options.xaxis.max=ranges.xaxis.to;
graph = $.plot($(graph_jq_id), rf_this.selection_range.trim_flot_data(flot_data), graph_options);
// don't fire event on the scale to prevent eternal loop