luci/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpufreq.js
Jo-Philipp Wich 9680fdea9e luci-app-statistics: convert graph rendering to client side js
This conversion requires cgi-io >= version 17 and uhttpd version >= 2020-02-12
to function properly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-13 20:45:26 +01:00

57 lines
1.2 KiB
JavaScript

/* Licensed to the public under the Apache License 2.0. */
'use strict';
'require uci';
return L.Class.extend({
title: _('CPU Frequency'),
rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
var cpufreq = {
title: "%H: Processor frequency - core %pi",
alt_autoscale: true,
vlabel: "Frequency (Hz)",
number_format: "%3.2lf%s",
data: {
types: [ "cpufreq" ],
options: {
cpufreq: { color: "ff0000", title: "Frequency" },
}
}
};
if (uci.get("luci_statistics", "collectd_cpufreq", "ExtraItems")) {
var transitions = {
title: "%H: Frequency transitions - core %pi",
alt_autoscale: true,
vlabel: "Transitions",
number_format: "%3.2lf%s",
data: {
types: [ "transitions" ],
options: {
transitions: { color: "0000ff", title: "Transitions", noarea: true },
}
}
};
var percentage = {
title: "%H: Frequency distribution - core %pi",
alt_autoscale: true,
vlabel: "Percent",
number_format: "%5.2lf%%",
ordercolor: true,
data: {
types: [ "percent" ],
options: {
percent: { title: "%di kHz", negweight: true },
}
}
};
return [ cpufreq, percentage, transitions ];
}
else {
return [ cpufreq ];
}
}
});