diff options
4 files changed, 30 insertions, 4 deletions
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua index 4586b23caa..c4ea88de92 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua @@ -407,7 +407,9 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index ) transform_rpn = dopts.transform_rpn or "0,+", noarea = dopts.noarea or false, title = dopts.title or nil, - weight = dopts.weight or nil, + weight = dopts.weight or + (dopts.negweight and -tonumber(dinst)) or + (dopts.posweight and tonumber(dinst)) or nil, ds = dsource, type = dtype, instance = dinst, @@ -487,6 +489,13 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index ) return x < y end) + -- define colors in order + if opts.ordercolor then + for i, source in ipairs(_sources) do + source.color = self.colors:defined(i) + end + end + -- create DEF statements for each instance for i, source in ipairs(_sources) do -- fixup properties for per instance mode... diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/colors.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/colors.lua index 0d3af712fd..88b3bbcfeb 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/colors.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/colors.lua @@ -25,6 +25,22 @@ function Instance.to_string( self, c ) ) end +function Instance.defined( self, i ) + local t = { + {230, 25, 75}, + {245, 130, 48}, + {255, 225, 25}, + {60, 180, 75}, + {70, 240, 240}, + {0, 130, 200}, + {0, 0, 128}, + {170, 110, 40} + } + return string.format( + "%02x%02x%02x", + t[(i-1) % #t + 1][1], t[(i-1) % #t +1][2], t[(i-1) % #t + 1][3] ) +end + function Instance.random( self ) local r = math.random(255) local g = math.random(255) diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua index 40a6955e53..d3596637b2 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua @@ -42,12 +42,13 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) local percentage = { title = "%H: Frequency distribution - core %pi", alt_autoscale = true, - vlabel = "Frequency (Hz)", + vlabel = "Percent", number_format = "%5.2lf%%", + ordercolor = true, data = { types = { "percent" }, options = { - percent = { title = "Frequency %di" }, + percent = { title = "%di Hz", negweight = true }, } } } diff --git a/modules/luci-base/root/www/index.html b/modules/luci-base/root/www/index.html index e964175829..6899820a44 100644 --- a/modules/luci-base/root/www/index.html +++ b/modules/luci-base/root/www/index.html @@ -2,7 +2,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> -<meta http-equiv="Cache-Control" content="no-cache" /> +<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="refresh" content="0; URL=/cgi-bin/luci/" /> </head> <body style="background-color: white"> |