From 36d2b62888107b85ca8dcad0e86f9c43a4f7b867 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Mon, 16 Dec 2013 21:48:20 +0100 Subject: jsrrdgraph: RrdGraph.js: splitting RrdGraph.prototype.graph_paint into init, fetch and draw --- js/RrdGraph.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/RrdGraph.js b/js/RrdGraph.js index cd422fd..235b35f 100644 --- a/js/RrdGraph.js +++ b/js/RrdGraph.js @@ -2541,7 +2541,7 @@ RrdGraph.prototype.graph_size_location = function (elements) return 0; }; -RrdGraph.prototype.graph_paint = function() +RrdGraph.prototype.graph_paint_init = function() { if (this.logarithmic && this.minval <= 0) throw new RrdGraphError("for a logarithmic yaxis you must specify a lower-limit > 0"); @@ -2573,11 +2573,13 @@ RrdGraph.prototype.graph_paint = function() // this.gdes[i].end_orig = this.end; } +} + +RrdGraph.prototype.graph_paint_draw = function() +{ var areazero = 0.0 var lastgdes = null; - if (this.data_fetch() === -1) - return -1; if (this.data_calc() === -1) return -1; var i = this.print_calc(); @@ -2825,6 +2827,14 @@ RrdGraph.prototype.graph_paint = function() return 0; }; +RrdGraph.prototype.graph_paint = function () +{ + this.graph_paint_init() + if (this.data_fetch() === -1) + return -1; + return this.graph_paint_draw() +}; + RrdGraph.prototype.find_var = function(key) { for (var ii = 0, gdes_c = this.gdes.length; ii < gdes_c; ii++) { -- cgit v1.1