KBN is a library that was created to scale and format numbers with common units. KBN is still in the early stages of development, so it may not be useful yet.
For more information, contact Netuitive support at [email protected].
bower install https://github.com/Netuitive/kbn#master
gulp production
gulp
-
The below command will attempt to find a unit based on a given string.
kbn.findUnitFormat(unit)
-
The below command will scale the given value by the given unit, round to 4 significant digits, and return a string representation of the value with the scaled units.
kbn.formatValue(value, unit)
Supported unit codes recognized by the formatValue api call:
Code | Unit |
---|---|
short | short |
percent | percent (0-100) |
percentunit | percent (0.0-1.0) |
humidity | Humidity (%H) |
ppm | ppm |
dB | decibel |
Code | Unit |
---|---|
bits | bits |
bytes | bytes (base2) |
bytesd | bytes (base10) |
kbytes | kilobytes |
kibytes | kibibytes |
mbytes | megabytes |
mibytes | mebibytes |
gbytes | gigabytes |
gibytes | gibibytes |
Code | Unit |
---|---|
pps | packets/sec |
bps | bits/sec |
Bps | bytes/sec |
kBps | kilobytes/sec |
mBps | megabytes/sec |
gBps | gigabytes/sec |
Code | Unit |
---|---|
hertz | Hertz (1/s) |
ns | nanoseconds (ns) |
µs | microseconds (µs) |
ms | milliseconds (ms) |
s | seconds (s) |
m | minutes (m) |
hours | (h) |
d | days (d) |
Code | Unit |
---|---|
ops | ops/sec (ops) |
rps | reads/sec (rps) |
wps | writes/sec (wps) |
iops | I/O ops/sec (iops) |
Code | Unit |
---|---|
fps | faults/sec (fps) |
Pps | pages/sec (Pps) |
Code | Unit |
---|---|
currencyUSD | Dollars ($) |
currencyGBP | Pounds (£) |
currencyEUR | Euro (€) |
currencyJPY | Yen (¥) |
Code | Unit |
---|---|
lengthmm | millimetre (mm) |
lengthm | meter (m) |
lengthkm | kilometer (km) |
lengthmi | mile (mi) |
Code | Unit |
---|---|
velocityms | m/s |
velocitykmh | km/h |
velocitymph | mph |
velocityknot | knot (kn) |
Code | Unit |
---|---|
mlitre | millilitre |
litre | litre |
m3 | cubic metre |
Code | Unit |
---|---|
watt | watt (W) |
kwatt | kilowatt (kW) |
watth | watt-hour (Wh) |
kwatth | kilowatt-hour (kWh) |
joule | joule (J) |
ev | electron volt (eV) |
amp | Ampere (A) |
volt | Volt (V) |
Code | Unit |
---|---|
celsius | Celcius (°C) |
farenheit | Farenheit (°F) |
kelvin | Kelvin (K) |
Code | Unit |
---|---|
pressurembar | Millibars |
pressurehpa | Hectopascals |
pressurehg | Inches of mercury |
pressurepsi | PSI |
KBN was originally imported from Graphana.