mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
fix format function for X axis of custom graphs
This commit is contained in:
parent
e30b9a32d8
commit
0c3a7166e0
@ -458,10 +458,19 @@ function pandoraFlotHBars(
|
|||||||
// v, axis;
|
// v, axis;
|
||||||
function xFormatter(v) {
|
function xFormatter(v) {
|
||||||
var label = parseFloat(v);
|
var label = parseFloat(v);
|
||||||
|
|
||||||
|
const unit_prefixes = ["K", "M", "G"];
|
||||||
|
var unit_prefix;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
while (label >= 1000 && i < 3) {
|
||||||
|
label = label / 1000;
|
||||||
|
unit_prefix = unit_prefixes[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
var text = label.toLocaleString();
|
var text = label.toLocaleString();
|
||||||
if (label >= 1000000) text = text.substring(0, 4) + "M";
|
|
||||||
else if (label >= 100000) text = text.substring(0, 3) + "K";
|
text = text + unit_prefix;
|
||||||
else if (label >= 1000) text = text.substring(0, 2) + "K";
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
'<div style="font-size:' +
|
'<div style="font-size:' +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user