Merge branch 'ent-5395-Pelayo-Fallo-en-el-eje-de-titulos-de-los-custom-graphs-de-barra' into 'develop'
fix format function for X axis of custom graphs See merge request artica/pandorafms!3138
This commit is contained in:
commit
846e6100b8
|
@ -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…
Reference in New Issue