luci-app-statistics: add noavg option
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 18 Aug 2020 10:50:46 +0000 (12:50 +0200)
committerHannu Nyman <hannu.nyman@iki.fi>
Tue, 8 Sep 2020 04:57:35 +0000 (07:57 +0300)
It is sometimes useful not to display avg values int the graph.
This option is used to prevent this from appearing in the graph.
In a graph definition this option must be set to *true*,
 if the avg values should not be displayed.

```
options = {
gauge = {
title = "Status",
color = "0000ff",
noarea = true,
noavg = true
}
```

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool.js

index 092dd45522a368a25a755b51e4c80071d5efa467..775db9bc3b29d39fe54ce4e5d62738b72f11921c 100644 (file)
@@ -516,7 +516,8 @@ return baseclass.extend({
                                _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));
+                       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],