From a48dd7a95f71869a367a3f32787660bb0a88eadb Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Sat, 1 Jan 2011 15:34:11 +0000 Subject: some refactoring required to get things working... --- jarmon/jarmon.js | 72 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js index e6a7814..ccfbc8e 100644 --- a/jarmon/jarmon.js +++ b/jarmon/jarmon.js @@ -394,13 +394,17 @@ jarmon.RrdQueryDsProxy.prototype.getData = function(startTime, endTime) { * @param options {Object} Flot options which control how the chart should be * drawn. **/ -jarmon.Chart = function(template, recipe) { +jarmon.Chart = function(template, recipe, downloader) { this.template = template; this.recipe = recipe; + this.downloader = downloader; + this.options = jQuery.extend(true, {yaxis: {}}, recipe.options); this.data = []; + this.setup(); + var self = this; @@ -416,7 +420,7 @@ jarmon.Chart = function(template, recipe) { {self: this}, function(e) { var self = e.data.self; - new jarmon.ChartEditor($(this).closest('.graph-legend'), self.recipe).draw(); + new jarmon.ChartEditor($(this).closest('.graph-legend'), self).draw(); } ); @@ -481,6 +485,24 @@ jarmon.Chart = function(template, recipe) { }; }; +jarmon.Chart.prototype.setup = function() { + this.template.find('.title').text(this.recipe['title']); + this.data = []; + var recipe = this.recipe; + var dataDict = {}; + for(var j=0; j 0) { - template = templateFactory(); - template.find('.title').text(recipe['title']); - c = new jarmon.Chart(template, recipe); - for(j=0; j', { type: 'text', name: 'title', - value: this.recipe.title + value: this.chart.recipe.title }) ) ), @@ -949,8 +951,8 @@ jarmon.ChartEditor.prototype.draw = function() { $('', {type: 'reset', value: 'reset'}) ).appendTo(this.$tpl); - for(var i=0; i