* luci/app/livestats: fix load diagram, improvements for diagram layout, fix menu...
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 20 Oct 2008 19:00:17 +0000 (19:00 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 20 Oct 2008 19:00:17 +0000 (19:00 +0000)
applications/luci-livestats/htdocs/luci-static/resources/livestats/GraphRPC.js
applications/luci-livestats/luasrc/controller/livestats.lua
applications/luci-livestats/luasrc/view/livestats/loadavg.htm
applications/luci-livestats/luasrc/view/livestats/traffic.htm
applications/luci-livestats/luasrc/view/livestats/wireless.htm

index 9ac291fd02308d8f50f3059f3f94f6f5ded510c2..a7a89ffd293823df12e72c67f9813a10c93ba765 100644 (file)
@@ -25,7 +25,6 @@ function Graph(container, id, options, transform) {
 }
 
 Graph.prototype.addDataset = function(name, ds) {
-       if( window.console ) console.debug("AddDataset: " + name);
        if( !this.layout ) {
                this.layout = new PlotKit.Layout( this.type, this.options );
        }
@@ -41,7 +40,6 @@ Graph.prototype.addDataset = function(name, ds) {
 }
 
 Graph.prototype.updateDataset = function(name, value) {
-       if( window.console ) console.debug("UpdateDataset: " + name + " " + value);
        if( this.dataset[name] ) {
                var ds = this.dataset[name];
 
@@ -140,39 +138,37 @@ GraphRPC.prototype.dispatchResponse = function(response) {
                                        this.graphs[gid].updateDataset(
                                                name, instance
                                                        ? response[instance][this.ds[i]]
-                                                       : response[parseInt(this.ds[i])]
+                                                       : response[this.ds[i]]
                                        );
                                        this.graphs[gid].redraw();
                                }
                        }
                }
                else {
-                       if( !this.graphs[instance] ) {
-                               this.graphs[instance] = new Graph(
-                                       this.container, instance, this.options, this.transform
+                       var gid = instance || 'livegraph';
+                       if( !this.graphs[gid] ) {
+                               this.graphs[gid] = new Graph(
+                                       this.container, gid, this.options, this.transform
                                );
-                               if( window.console ) console.debug("NG: " + instance);
 
                                for( var i = 0; i < this.ds.length; i += 2 ) {
                                        var name = this.ds[i+1] || this.ds[i];
-                                       if( window.console ) console.debug("ADS: " + name);
-                                       this.graphs[instance].addDataset(name);
+                                       this.graphs[gid].addDataset(name);
                                }
 
-                               this.graphs[instance].draw();
+                               this.graphs[gid].draw();
                        }
                        else {
                                for( var i = 0; i < this.ds.length; i += 2 ) {
                                        var name = this.ds[i+1] || this.ds[i];
-                                       if( window.console ) console.debug("UDS: " + name + " " + response[instance][this.ds[i]]);
-                                       this.graphs[instance].updateDataset(
+                                       this.graphs[gid].updateDataset(
                                                name, instance
                                                        ? response[instance][this.ds[i]]
-                                                       : response[parseInt(this.ds[i])]
+                                                       : response[this.ds[i]]
                                        );
                                }
 
-                               this.graphs[instance].redraw();
+                               this.graphs[gid].redraw();
                        }
                }
        }
index 0ca22762236ba131c63c1fcf41dbb9b16097ee40..5211f7925bb6206ec43d6aa6faff07b6db95284a 100644 (file)
@@ -19,7 +19,7 @@ function index()
        require("luci.i18n")
        luci.i18n.loadc("livestats")
 
-       entry( {"admin", "status", "wifistat"}, template("livestats/wireless"), luci.i18n.translate("livestat_wireless", "Live Wireless Statistics") ).i18n = "livestat"
-       entry( {"admin", "status", "trafstat"}, template("livestats/traffic"),  luci.i18n.translate("livestat_traffic",  "Live Traffic Statistics")  ).i18n = "livestat"
-       entry( {"admin", "status", "loadavg"},  template("livestats/loadavg"),  luci.i18n.translate("livestat_loadavg",  "Live Load Statistics")     ).i18n = "livestat"
+       entry( {"admin", "status", "wifistat"}, template("livestats/wireless"), luci.i18n.translate("livestat_wireless", "Live Wireless Statistics"), 90 ).i18n = "livestat"
+       entry( {"admin", "status", "trafstat"}, template("livestats/traffic"),  luci.i18n.translate("livestat_traffic",  "Live Traffic Statistics"),  91 ).i18n = "livestat"
+       entry( {"admin", "status", "loadavg"},  template("livestats/loadavg"),  luci.i18n.translate("livestat_loadavg",  "Live Load Statistics"),     92 ).i18n = "livestat"
 end
index a4e8fae00a39d64ec26783f2e50cd17a1cfd27fa..f1d434b5d2ea8d53c03ab5f76eceb40889ef6880 100644 (file)
                        2000,
 
                        // Data sources
-                       [ "1", "1 Minute Load", "2", "5 Minutes Load", "3", "15 Minutes Load" ],
+                       [ 0, "1 Minute Load", 1, "5 Minutes Load", 2, "15 Minutes Load" ],
 
                        // Graph layout options
-                       { shouldFill: false, strokeColor: null,
+                       { shouldFill: false, drawBackground: false, strokeColor: null,
                          strokeColorTransform: "asFillColor",
                          title: 'Average Load', strokeWidth: 1,
                          padding: { left: 70, right: 10, top: 10, bottom: 20 },
-                         instances: [ false ] }
+                         instances: [ false ], yAxis: [ 0, 2 ] }
                );
        }
 
index d914fddc4425ce92afb88ac9e1995e09729bae1e..083b5cc2e6d04723c12910122ca7b83f20980de2 100644 (file)
@@ -32,7 +32,7 @@
                        [ "1", "received Bytes/s", "9", "transmitted Bytes/s" ],
 
                        // Graph layout options
-                       { shouldFill: false, strokeColor: null,
+                       { shouldFill: true, drawBackground: false, strokeColor: null,
                          strokeColorTransform: "asFillColor",
                          title: 'Traffic on interface "%s"',
                          separateDS: true, strokeWidth: 0.5, height: 140,
index 2ee60139e024ca478bb080e39a8f5b15aac9fd59..2e34df978e69ada25d31164f793a40c8e1b6bde5 100644 (file)
@@ -17,7 +17,8 @@
                        [ "Noise level", null, "Signal level", null ],
 
                        // Graph layout options
-                       { yAxis: [ 0, 150 ], title: 'Wifi Interface "%s": Signal and Noise',
+                       { drawBackground: false, yAxis: [ 0, 150 ],
+                         title: 'Wifi Interface "%s": Signal and Noise',
                          padding: { left: 40, right: 10, top: 10, bottom: 20 } }
                );
        }