luci-app-statistics: adjust graph size fallback to defaults
[project/luci.git] / applications / luci-app-statistics / htdocs / luci-static / resources / statistics / rrdtool.js
index 092dd45522a368a25a755b51e4c80071d5efa467..0e8414ff2f5ce4825ce1022dbda5f71a7acd3ad3 100644 (file)
@@ -149,9 +149,9 @@ return baseclass.extend({
                            hostname = data[1];
 
                        this.opts.host      = uci.get('luci_statistics', 'collectd', 'Hostname')        || hostname;
-                       this.opts.timespan  = uci.get('luci_statistics', 'rrdtool', 'default_timespan') || 900;
-                       this.opts.width     = uci.get('luci_statistics', 'rrdtool', 'image_width')      || 400;
-                       this.opts.height    = uci.get('luci_statistics', 'rrdtool', 'image_height')     || 100;
+                       this.opts.timespan  = uci.get('luci_statistics', 'rrdtool', 'default_timespan') || 3600;
+                       this.opts.width     = uci.get('luci_statistics', 'rrdtool', 'image_width')      || 600;
+                       this.opts.height    = uci.get('luci_statistics', 'rrdtool', 'image_height')     || 150;
                        this.opts.rrdpath   = (uci.get('luci_statistics', 'collectd_rrdtool', 'DataDir') || '/tmp/rrd').replace(/\/$/, '');
                        this.opts.rrasingle = (uci.get('luci_statistics', 'collectd_rrdtool', 'RRASingle') == '1');
                        this.opts.rramax    = (uci.get('luci_statistics', 'collectd_rrdtool', 'RRAMax') == '1');
@@ -334,7 +334,7 @@ return baseclass.extend({
                var cmdline = [
                        'graph', '-', '-a', 'PNG',
                        '-s', 'NOW-%s'.format(timespan || this.opts.timespan),
-                       '-e', 'NOW-60',
+                       '-e', 'NOW-15',
                        '-w', width || this.opts.width,
                        '-h', height || this.opts.height
                ];
@@ -376,7 +376,7 @@ return baseclass.extend({
 
                function __def(source) {
                        var inst = source.sname,
-                           rrd  = source.rrd.replace(/[\\:]/g, '\\$&'),
+                           rrd  = source.rrd,
                            ds   = source.ds || 'value';
 
                        _args.push(
@@ -515,8 +515,9 @@ return baseclass.extend({
                        if (!gopts.rrasingle)
                                _args.push('GPRINT:%s_min:MIN:\tMin\\: %s'.format(source.sname, numfmt));
 
-                       /* always include AVERAGE */
-                       _args.push('GPRINT:%s_avg:AVERAGE:\tAvg\\: %s'.format(source.sname, numfmt));
+                       /* don't include AVERAGE if noavg option is set */
+                       if (!source.noavg)
+                               _args.push('GPRINT:%s_avg:AVERAGE:\tAvg\\: %s'.format(source.sname, numfmt));
 
                        /* don't include MAX if rrasingle is enabled */
                        if (!gopts.rrasingle)
@@ -605,6 +606,7 @@ return baseclass.extend({
                                                overlay: dopts.overlay || false,
                                                transform_rpn: dopts.transform_rpn || '0,+',
                                                noarea: dopts.noarea || false,
+                                               noavg: dopts.noavg || false,
                                                title: dopts.title || null,
                                                weight: dopts.weight || (dopts.negweight ? -+data_instances[j] : null) || (dopts.posweight ? +data_instances[j] : null) || null,
                                                ds: data_sources[k],