Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
43c2ca2d
Commit
43c2ca2d
authored
Oct 14, 2015
by
Greg Look
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group value formats by type.
parent
e3e21a25
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
18 deletions
+35
-18
public/app/components/kbn.js
+35
-18
No files found.
public/app/components/kbn.js
View file @
43c2ca2d
...
@@ -199,10 +199,6 @@ function($, _) {
...
@@ -199,10 +199,6 @@ function($, _) {
return
new
RegExp
(
match
[
1
],
match
[
2
]);
return
new
RegExp
(
match
[
1
],
match
[
2
]);
};
};
kbn
.
valueFormats
.
percent
=
function
(
size
,
decimals
)
{
return
kbn
.
toFixed
(
size
,
decimals
)
+
'%'
;
};
kbn
.
formatFuncCreator
=
function
(
factor
,
extArray
)
{
kbn
.
formatFuncCreator
=
function
(
factor
,
extArray
)
{
return
function
(
size
,
decimals
,
scaledDecimals
)
{
return
function
(
size
,
decimals
,
scaledDecimals
)
{
if
(
size
===
null
)
{
if
(
size
===
null
)
{
...
@@ -253,36 +249,57 @@ function($, _) {
...
@@ -253,36 +249,57 @@ function($, _) {
return
formatted
;
return
formatted
;
};
};
kbn
.
valueFormats
.
bits
=
kbn
.
formatFuncCreator
(
1024
,
[
' b'
,
' Kib'
,
' Mib'
,
' Gib'
,
' Tib'
,
' Pib'
,
' Eib'
,
' Zib'
,
' Yib'
]);
///// VALUE FORMATS /////
kbn
.
valueFormats
.
bytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' B'
,
' KiB'
,
' MiB'
,
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
// Dimensionless Units
kbn
.
valueFormats
.
none
=
kbn
.
toFixed
;
kbn
.
valueFormats
.
short
=
kbn
.
formatFuncCreator
(
1000
,
[
''
,
' K'
,
' Mil'
,
' Bil'
,
' Tri'
,
' Quadr'
,
' Quint'
,
' Sext'
,
' Sept'
]);
kbn
.
valueFormats
.
ppm
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' ppm'
;
};
kbn
.
valueFormats
.
percent
=
function
(
size
,
decimals
)
{
return
kbn
.
toFixed
(
size
,
decimals
)
+
'%'
;
};
// Data
kbn
.
valueFormats
.
bits
=
kbn
.
formatFuncCreator
(
1024
,
[
' b'
,
' Kib'
,
' Mib'
,
' Gib'
,
' Tib'
,
' Pib'
,
' Eib'
,
' Zib'
,
' Yib'
]);
kbn
.
valueFormats
.
bytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' B'
,
' KiB'
,
' MiB'
,
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
kbn
.
valueFormats
.
kbytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' KiB'
,
' MiB'
,
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
kbn
.
valueFormats
.
kbytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' KiB'
,
' MiB'
,
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
kbn
.
valueFormats
.
mbytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' MiB'
,
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
kbn
.
valueFormats
.
mbytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' MiB'
,
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
kbn
.
valueFormats
.
gbytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
kbn
.
valueFormats
.
gbytes
=
kbn
.
formatFuncCreator
(
1024
,
[
' GiB'
,
' TiB'
,
' PiB'
,
' EiB'
,
' ZiB'
,
' YiB'
]);
kbn
.
valueFormats
.
bps
=
kbn
.
formatFuncCreator
(
1000
,
[
' bps'
,
' Kbps'
,
' Mbps'
,
' Gbps'
,
' Tbps'
,
' Pbps'
,
' Ebps'
,
' Zbps'
,
' Ybps'
]);
// Data Rate
kbn
.
valueFormats
.
pps
=
kbn
.
formatFuncCreator
(
1000
,
[
' pps'
,
' Kpps'
,
' Mpps'
,
' Gpps'
,
' Tpps'
,
' Ppps'
,
' Epps'
,
' Zpps'
,
' Ypps'
]);
kbn
.
valueFormats
.
pps
=
kbn
.
formatFuncCreator
(
1000
,
[
' pps'
,
' Kpps'
,
' Mpps'
,
' Gpps'
,
' Tpps'
,
' Ppps'
,
' Epps'
,
' Zpps'
,
' Ypps'
]);
kbn
.
valueFormats
.
bps
=
kbn
.
formatFuncCreator
(
1000
,
[
' bps'
,
' Kbps'
,
' Mbps'
,
' Gbps'
,
' Tbps'
,
' Pbps'
,
' Ebps'
,
' Zbps'
,
' Ybps'
]);
kbn
.
valueFormats
.
Bps
=
kbn
.
formatFuncCreator
(
1000
,
[
' Bps'
,
' KBps'
,
' MBps'
,
' GBps'
,
' TBps'
,
' PBps'
,
' EBps'
,
' ZBps'
,
' YBps'
]);
kbn
.
valueFormats
.
Bps
=
kbn
.
formatFuncCreator
(
1000
,
[
' Bps'
,
' KBps'
,
' MBps'
,
' GBps'
,
' TBps'
,
' PBps'
,
' EBps'
,
' ZBps'
,
' YBps'
]);
kbn
.
valueFormats
.
short
=
kbn
.
formatFuncCreator
(
1000
,
[
''
,
' K'
,
' Mil'
,
' Bil'
,
' Tri'
,
' Quadr'
,
' Quint'
,
' Sext'
,
' Sept'
]);
kbn
.
valueFormats
.
joule
=
kbn
.
formatFuncCreator
(
1000
,
[
' J'
,
' kJ'
,
' MJ'
,
' GJ'
,
' TJ'
,
' PJ'
,
' EJ'
,
' ZJ'
,
' YJ'
]);
// Energy
kbn
.
valueFormats
.
amp
=
kbn
.
formatFuncCreator
(
1000
,
[
' A'
,
' kA'
,
' MA'
,
' GA'
,
' TA'
,
' PA'
,
' EA'
,
' ZA'
,
' YA'
]);
kbn
.
valueFormats
.
watt
=
kbn
.
formatFuncCreator
(
1000
,
[
' W'
,
' kW'
,
' MW'
,
' GW'
,
' TW'
,
' PW'
,
' EW'
,
' ZW'
,
' YW'
]);
kbn
.
valueFormats
.
volt
=
kbn
.
formatFuncCreator
(
1000
,
[
' V'
,
' kV'
,
' MV'
,
' GV'
,
' TV'
,
' PV'
,
' EV'
,
' ZV'
,
' YV'
]);
kbn
.
valueFormats
.
kwatt
=
kbn
.
formatFuncCreator
(
1000
,
[
' kW'
,
' MW'
,
' GW'
,
' TW'
,
' PW'
,
' EW'
,
' ZW'
,
' YW'
]);
kbn
.
valueFormats
.
hertz
=
kbn
.
formatFuncCreator
(
1000
,
[
' Hz'
,
' kHz'
,
' MHz'
,
' GHz'
,
' THz'
,
' PHz'
,
' EHz'
,
' ZHz'
,
' YHz'
]);
kbn
.
valueFormats
.
watth
=
kbn
.
formatFuncCreator
(
1000
,
[
' Wh'
,
' kWh'
,
' MWh'
,
' GWh'
,
' TWh'
,
' PWh'
,
' EWh'
,
' ZWh'
,
' YWh'
]);
kbn
.
valueFormats
.
watt
=
kbn
.
formatFuncCreator
(
1000
,
[
' W'
,
' kW'
,
' MW'
,
' GW'
,
' TW'
,
' PW'
,
' EW'
,
' ZW'
,
' YW'
]);
kbn
.
valueFormats
.
kwatt
=
kbn
.
formatFuncCreator
(
1000
,
[
' kW'
,
' MW'
,
' GW'
,
' TW'
,
' PW'
,
' EW'
,
' ZW'
,
' YW'
]);
kbn
.
valueFormats
.
watth
=
kbn
.
formatFuncCreator
(
1000
,
[
' Wh'
,
' kWh'
,
' MWh'
,
' GWh'
,
' TWh'
,
' PWh'
,
' EWh'
,
' ZWh'
,
' YWh'
]);
kbn
.
valueFormats
.
kwatth
=
kbn
.
formatFuncCreator
(
1000
,
[
' kWh'
,
' MWh'
,
' GWh'
,
' TWh'
,
' PWh'
,
' EWh'
,
' ZWh'
,
' YWh'
]);
kbn
.
valueFormats
.
kwatth
=
kbn
.
formatFuncCreator
(
1000
,
[
' kWh'
,
' MWh'
,
' GWh'
,
' TWh'
,
' PWh'
,
' EWh'
,
' ZWh'
,
' YWh'
]);
kbn
.
valueFormats
.
ev
=
kbn
.
formatFuncCreator
(
1000
,
[
' eV'
,
' keV'
,
' MeV'
,
'GeV'
,
'TeV'
,
'PeV'
,
'EeV'
,
'ZeV'
,
'YeV'
]);
kbn
.
valueFormats
.
joule
=
kbn
.
formatFuncCreator
(
1000
,
[
' J'
,
' kJ'
,
' MJ'
,
' GJ'
,
' TJ'
,
' PJ'
,
' EJ'
,
' ZJ'
,
' YJ'
]);
kbn
.
valueFormats
.
none
=
kbn
.
toFixed
;
kbn
.
valueFormats
.
ev
=
kbn
.
formatFuncCreator
(
1000
,
[
' eV'
,
' keV'
,
' MeV'
,
'GeV'
,
'TeV'
,
'PeV'
,
'EeV'
,
'ZeV'
,
'YeV'
]);
kbn
.
valueFormats
.
amp
=
kbn
.
formatFuncCreator
(
1000
,
[
' A'
,
' kA'
,
' MA'
,
' GA'
,
' TA'
,
' PA'
,
' EA'
,
' ZA'
,
' YA'
]);
kbn
.
valueFormats
.
volt
=
kbn
.
formatFuncCreator
(
1000
,
[
' V'
,
' kV'
,
' MV'
,
' GV'
,
' TV'
,
' PV'
,
' EV'
,
' ZV'
,
' YV'
]);
// Temperature
kbn
.
valueFormats
.
celsius
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' °C'
;
};
kbn
.
valueFormats
.
celsius
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' °C'
;
};
kbn
.
valueFormats
.
farenheit
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' °F'
;
};
kbn
.
valueFormats
.
farenheit
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' °F'
;
};
kbn
.
valueFormats
.
humidity
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' %H'
;
};
kbn
.
valueFormats
.
humidity
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' %H'
;
};
// Pressure
kbn
.
valueFormats
.
pressurembar
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' mbar'
;
};
kbn
.
valueFormats
.
pressurembar
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' mbar'
;
};
kbn
.
valueFormats
.
pressurehpa
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' hPa'
;
};
kbn
.
valueFormats
.
pressurehpa
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' hPa'
;
};
kbn
.
valueFormats
.
ppm
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' ppm'
;
};
// Velocity
kbn
.
valueFormats
.
velocityms
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' m/s'
;
};
kbn
.
valueFormats
.
velocityms
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' m/s'
;
};
kbn
.
valueFormats
.
velocitykmh
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' km/h'
;
};
kbn
.
valueFormats
.
velocitykmh
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' km/h'
;
};
kbn
.
valueFormats
.
velocitymph
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' mph'
;
};
kbn
.
valueFormats
.
velocitymph
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' mph'
;
};
kbn
.
valueFormats
.
velocityknot
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' kn'
;
};
kbn
.
valueFormats
.
velocityknot
=
function
(
value
,
decimals
)
{
return
kbn
.
toFixed
(
value
,
decimals
)
+
' kn'
;
};
// Time
kbn
.
valueFormats
.
hertz
=
kbn
.
formatFuncCreator
(
1000
,
[
' Hz'
,
' kHz'
,
' MHz'
,
' GHz'
,
' THz'
,
' PHz'
,
' EHz'
,
' ZHz'
,
' YHz'
]);
kbn
.
roundValue
=
function
(
num
,
decimals
)
{
kbn
.
roundValue
=
function
(
num
,
decimals
)
{
if
(
num
===
null
)
{
return
null
;
}
if
(
num
===
null
)
{
return
null
;
}
var
n
=
Math
.
pow
(
10
,
decimals
);
var
n
=
Math
.
pow
(
10
,
decimals
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment