Title

Global

Methods

# averageTime(time) → {string}

Converts an Array of Numbers (times) to a date string in the format MM:SS.sss where the Time is the Average Time of the Array Input.

Parameters:
Name Type Description
time Array.<Number>

An Array of Numbers (Times)

View Source constants/graphFunctions/graphFunctions.js, line 104

datestring - Returns a readable date string based on the average of the array of times.

string
Example
averageTime([30000,25000,35000])
 return (
     00:30.00
)

# colorArray(arrayLength) → {Array.<String>}

Color Array takes input arrayLength (Number). It returns an array of gradient colors the same length as the input. Useful for creating a gradient of colours for a data set that will differ but match a color scheme / theme.

Parameters:
Name Type Description
arrayLength Number

The length of the Data Array denoting, how many colours along the gradient will be needed.

View Source constants/graphFunctions/graphFunctions.js, line 266

colorArray

Array.<String>
Example
colorArray(10)
 return (
     ["#00aad8", "#1aa3d0", "#339cc7", "#4d95bf", "#668eb6", "#8087ae", "#997fa6", "#b3789d", "#cc7195","#e66a8c"]
)

# medianTime(time, time) → {string}

Converts an Array of Numbers (times) to a date string in the format MM:SS.sss where the Time is the Median of the Array

Parameters:
Name Type Description
time Array.<Number>

An Array of Numbers (Times)

time Array.<Number>

An Array of Numbers (Times)

View Source constants/graphFunctions/graphFunctions.js, line 127

datestring - Returns a readable date string based on the median of the array of times.

string
Example
medianTime([30000,25000,35000])
 return (
     00:30.00
)

# meetCity(meetcitys) → {Array.<String>}

Takes an Array of Objects and returns an Array of all meets in each meet in the respective Objects.

Parameters:
Name Type Description
meetcitys Array.<object>

An Object Array of all entities in the respective excel sheet to for the Swimming Race.

View Source constants/graphFunctions/graphFunctions.js, line 221

Array.<String>
Example
meetCity(Object('__EMPTY_':..., '__EMPTY_11': 'Toronto'), Object('__EMPTY_':..., '__EMPTY_11': 'Winnipeg' ), Object('__EMPTY_':..., '__EMPTY_11': 'Toronto'))
 return (
     ['Toronto', 'Winnipeg', 'Toronto']
)

# meetMonth(meets) → {Array.<object>}

Converts the Array of Swimmer Objects.__EMPTY_10 property (Meet Month is stored in excel date value), into a usable month to be viewed and compared with against. Where the month is in [0,1,2,3,4,..11] (with 0 being january and so on)

Parameters:
Name Type Description
meets Array.<object>

Takes an Array of Swimmer Objects to convert dates on.

View Source constants/graphFunctions/graphFunctions.js, line 51

Where .__EMPTY_10 is now a useable month from JS Date.

Array.<object>
Example
meetMonth([Object('__EMPTY_':..., '__EMPTY_10': 36949)]) // * __EMPTY_10 is in excel date value

[Object('__EMPTY_':..., '__EMPTY_10': 36949)] // * __EMPTY_10 is in excel date value

return (
[Object('__EMPTY_1':..., '__EMPTY_10': 0)] // * __EMPTY_10 is now a single value contaning the month corresponding months
) 

# meetName(meets) → {Array.<String>}

Takes an Array of Objects and returns an Array of all meet names from each object

Parameters:
Name Type Description
meets Array.<object>

An Object Array of all entities in the respective excel sheet to for the Swimming Race.

View Source constants/graphFunctions/graphFunctions.js, line 239

meets

Array.<String>
Example
meetName(Object('__EMPTY_':..., '__EMPTY_12': 'Victor Davis'), Object('__EMPTY_':..., '__EMPTY_12': 'Dash For Cash' ), Object('__EMPTY_':..., '__EMPTY_12': 'HOBBS'))
 return (
     ['Victor Davis', 'Dash For Cash', 'HOBBS']
)

# modeTime(time) → {object|object}

Finds the Mode an Array of Numbers (times) and returns an object with the Mode Time and the number of Occurrences.

Parameters:
Name Type Description
time Array.<Number>

An Array of Numbers (Times)

View Source constants/graphFunctions/graphFunctions.js, line 161

{mostCommonNumber} Returns The Most Common Number in Array

object

{maxCount} Returns the count of the Most Common Number

object
Example
modeTime([30000,25000,35000,30000])
 return (
 {
  "mostCommonNumber": 30,
  "maxCount": 2
    }
)

# mostOccurrences(arr) → {Map}

Takes an array of (numbers/strings/dates) and find the number of occurrences of each distinct element. it returns a Map (key,value) pairs. Key is the element and Value is the number of occurrences.

Parameters:
Name Type Description
arr Array

Takes an array of numbers/strings/dates to find the number of Occurrences of each distinct element.

View Source constants/graphFunctions/graphFunctions.js, line 15

Returns Map, where keys are the elements in the array and, value is the number of Occurrences of each element in the array.

Map
Example
mostOccurrences(['July','Aug','Sept','July','June']) 
return  (
  Map(['July',2],['Aug',1],['Sept',1],['June',1])
)

# peakDistribution(data) → {Array}

Takes the Array of Swimmer Objects and converts the months to be aligned on the graph correctly. Also finds the most Occurrences of the month data.

Parameters:
Name Type Description
data Array.<object>

Takes an Array of Swimmer Objects to convert dates and map.

View Source constants/graphFunctions/graphFunctions.js, line 73

Returns an Array where index[0] is September and the values of Occurrences in September is the value at the index.

Array
Example
peakDistribution(Object('__EMPTY_':..., '__EMPTY_10': 36949), Object('__EMPTY_':..., '__EMPTY_10': 36949), Object('__EMPTY_':..., '__EMPTY_10': 36949))
// 36949 -> January
return (
 // [sept,oct,nov,dec,jan,feb,mar,apr,may,june,july,aug]
 [0,0,0,0,3,0,0,0,0,0,0,0]
)

# standardDeviation(time) → {string}

Takes an Number[] times and calculates the Standard Deviation for the race times, returns a date string. Generally time is input in Milliseconds.

Parameters:
Name Type Description
time Array.<Number>

An Array of Numbers (times)

View Source constants/graphFunctions/graphFunctions.js, line 195

standardDev returns the date string with the standard deviation for data.

string
Example
// returns 00:03.30 (aka. 00:03.30 of standard deviation between time given in ms)
standardDeviation([ 9000, 2000, 5000, 4000, 12000, 7000]) 
return (
     00:03.30
)