ChartUtils Class
Item Index
Methods
Properties
Methods
abbreviateNumber
-
value
-
n
Takes a value and returns it's abbreviated text representation.
- If abs(val) > 1, the following standard abbreviations will be used:
- K thousands
- M million
- G billion
- T trillion
- P quadrillion
- E quintillion
F.i.:- 123 -> "123"
- 1234 -> "1.2K"
- 12345 -> "12.3K"
- 123456789 -> "123.4M"
- If abs(val)
WARNING: since shallow copy is used, only works for
primitive (immutable) values
Parameters:
-
value
String | NumberThe value to assign to each element of the newly created array. If value is a function, it is called n times, with no parameters
-
n
NumberThe size of the final array;
Must be a positive integer.
Returns:
addIntToTimeString
-
timeString
-
minutes
Takes a string and an int value and checks if it is a valid time representation, according to the format HH:MM
Parameters:
-
timeString
StringThe time string taken as initial time
-
minutes
NumberHow many minutes needs to be added to the time string;
Returns:
addTimeStrings
-
timeString_1
-
timeString_2
Takes two strings as input and checks if they are valid
time representations, according to the format HH:MM
If it is so, sums them and returns a new string representing
the resulting time;
Parameters:
-
timeString_1
StringThe first time string to be added
-
timeString_2
StringThe second time string to be added
Returns:
fillArray
-
value
-
n
Takes a value and a positive integer n and returns an Array of n copies of that value.
WARNING: since shallow copy is used, only works for
primitive (immutable) values
Parameters:
-
value
String | NumberThe value to assign to each element of the newly created array. If value is a function, it is called n times, with no parameters
-
n
NumberThe size of the final array;
Must be a positive integer.
Returns:
formatTimeString
-
HH
-
MM
Format a hours, minutes couple into a proper time string
INVARIANT: HH and MM must be valid, positive integers
(since it's a private method, defensive programming is avoided
If the overcome their range, proper formatting is enforced:
F.i. HH=23, MM=60 -> "00:00"
Parameters:
-
HH
NumberAn int value (between 0 and 23), representing the hours
-
MM
NumberAn int value (between 0 and 59), representing the minutes
Returns:
validateTimeString
-
timeString
Takes a string as input and checks if it is a valid time representation, according to the format HH:MM
Parameters:
-
timeString
StringThe string to be evaluated
Returns:
- An array with two integers, the values for hours and minutes <=> The input string validates successfully
- null Otherwise
Properties
SUFFIXES
Array
private
final
Abbreviations suffixes for large numbers;