From 55cca35ef38c4972a1c99ba8f3a490f9c070a3b5 Mon Sep 17 00:00:00 2001 From: Frank Wuerthwein Date: Mon, 16 Feb 2009 13:11:45 +0000 Subject: Add few more helper methods to rrdFlotSelection --- src/lib/rrdFlotSupport.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/lib/rrdFlotSupport.js') diff --git a/src/lib/rrdFlotSupport.js b/src/lib/rrdFlotSupport.js index ede309c..dc12f89 100644 --- a/src/lib/rrdFlotSupport.js +++ b/src/lib/rrdFlotSupport.js @@ -49,19 +49,29 @@ function rrdDS2FlotSeries(rrd_file,ds_id,rra_idx,want_label) { function rrdFlotSelection() { this.selection_min=null; this.selection_max=null; -} +}; // reset to a state where ther is no selection rrdFlotSelection.prototype.reset = function() { - this.selection_min=null; - this.selection_max=null; -} + this.selection_min=null; + this.selection_max=null; +}; // given the selection ranges, set internal variable accordingly rrdFlotSelection.prototype.setFromFlotRanges = function(ranges) { - this.selection_min=ranges.xaxis.from; - this.selection_max=ranges.xaxis.to; -} + this.selection_min=ranges.xaxis.from; + this.selection_max=ranges.xaxis.to; +}; + +// Return a Flot ranges structure that can be promptly used in setSelection +rrdFlotSelection.prototype.getFlotRanges = function() { + return { xaxis: {from: this.selection_min, to: this.selection_max}}; +}; + +// return true is a selection is in use +rrdFlotSelection.prototype.isSet = function() { + return this.selection_min!=null; +}; // Given an array of flot lines, limit to the selection rrdFlotSelection.prototype.trim_flot_data = function(flot_data) { -- cgit v1.2.3-54-g00ecf