Members
(constant) baseUrlApi
- Source:
base of the url to access the user api
(constant) chartDimensions
- Source:
adapts the dimensions of the graphic to those of the window
(constant) linkGenerator
generate pageMenu links
(constant) userService
- Source:
object containing user data collection functions
Methods
addTooltip(svg) → {object}
create tooltip to display curve informations
Parameters:
Name | Type | Description |
---|---|---|
svg |
object | svg dom object |
Returns:
tooltip svg group
- Type
- object
averageSessions(data, height, svg, width, marginopt)
generate user's average sessions chart
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
array | array of objects with day and sessionLength attributes |
|
height |
number | chart height |
|
svg |
object | svg contains chart |
|
width |
number | chart width |
|
margin |
object |
<optional> |
contains attributes : marginTop, marginRight, marginBottom, marginLeft |
Chart(data, name) → {object}
- Source:
display chart
Parameters:
Name | Type | Description |
---|---|---|
data |
array | array of objects with day and sessionLength attributes |
name |
string | chart name |
Returns:
GraphicContainer - styled component
- Type
- object
chartParamManager(chartName) → {object}
- Source:
provides charts parameters
Parameters:
Name | Type | Description |
---|---|---|
chartName |
string |
Returns:
constants - @see getChartConst()
- Type
- object
dailyActivity(data, height, svg, width, marginopt)
- Source:
create user daily activity chart
Example
data : [ { day: <string>, kilogram : <integer>, calories : <integer>}]
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
array | array of objects containing the data needed for the daily activity graph |
|
height |
number | chart height |
|
svg |
object | svg contains chart |
|
width |
number | chart width |
|
margin |
object |
<optional> |
contains attributes : marginTop, marginRight, marginBottom, marginLeft |
Error() → {object}
- Source:
Component for displaying error message when route does not exist
Returns:
StyledMain -
- Type
- object
getByIdApiRequest(userId) → {array}
- Source:
urls array used to retrieve user data from the API
Parameters:
Name | Type | Description |
---|---|---|
userId |
number | identifier of the user whose data is to be recovered |
Returns:
api urls array
- Type
- array
getByIdMocked(userId)
- Source:
retrieves user data mocked
Parameters:
Name | Type | Description |
---|---|---|
userId |
number | user identifier |
getChartConst(backgroundColor, chartFunction, containerWidth, height, width, marginTop, marginRight, marginBottom, marginLeft) → {object|object}
- Source:
provides the constants needed to create the chart
Example
{ backgroundColor, chartFunction, containerWidth, dimensions }
Parameters:
Name | Type | Description |
---|---|---|
backgroundColor |
string | chart container background |
chartFunction |
function | function called to create chart |
containerWidth |
number | |
height |
number | |
width |
number | |
marginTop |
number | |
marginRight |
number | |
marginBottom |
number | |
marginLeft |
number |
Returns:
-
constants
- Type
- object
-
constants.dimensions - contains attributes : marginTop, marginRight, marginBottom, marginLeft
- Type
- object
getDataObject(userInfos, userActivity, userSessions, userKeyData, userPerformance, userScore) → {object}
- Source:
groups the collected data into an object
Parameters:
Name | Type | Description |
---|---|---|
userInfos |
object | |
userActivity |
object | |
userSessions |
pbject | |
userKeyData |
object | |
userPerformance |
object | |
userScore |
object |
Returns:
user data object = { mainData, activity, sessions, keyData, performances, score }
- Type
- object
getDataObjectApi(userInfos, userActivity, userSessions, userKeyData, userPerformance, userScore) → {object}
- Source:
retrieves user data model
Parameters:
Name | Type | Description |
---|---|---|
userInfos |
object | |
userActivity |
object | |
userSessions |
pbject | |
userKeyData |
object | |
userPerformance |
object | |
userScore |
object |
Returns:
dataObject - @see getDataObject()
- Type
- object
Header() → {object}
- Source:
Component for displaying header page. header containt logo and navigation
Returns:
HeaderStyled - styled component
- Type
- object
Home() → {object}
- Source:
Display home page main element
Returns:
- Type
- object
PageMenu() → {object}
- Source:
Component for displaying lateral page menu
Returns:
MenuSection - styled component
- Type
- object
performances(data, height, svg, width, marginopt)
- Source:
generate user's performances chart
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
array | array of objects with day and sessionLength attributes |
|
height |
number | chart height |
|
svg |
object | svg contains chart |
|
width |
number | chart width |
|
margin |
object |
<optional> |
contains attributes : marginTop, marginRight, marginBottom, marginLeft |
Profil(idUser, dataFrom) → {object}
- Source:
Component for displaying user activity dashboard
Parameters:
Name | Type | Description |
---|---|---|
idUser |
number | user id |
dataFrom |
string | data source : api or mock |
Returns:
main dom object
- Type
- object
score(data, height, svg, width, backgroundColor)
- Source:
generate user score chart
Example
data : 0.17
Parameters:
Name | Type | Description |
---|---|---|
data |
number | user score in float format |
height |
number | chart height |
svg |
object | svg contains chart |
width |
number | chart width |
backgroundColor |
string | chart background color |
Summary(props) → {object}
- Source:
component for displaying summary of user indicators
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
object |
Properties
|
Returns:
section contain summary
- Type
- object
summaryItem(name, value) → {object}
- Source:
display summary item
Parameters:
Name | Type | Description |
---|---|---|
name |
string | summary item name |
value |
number | summary item value |
Returns:
summary item dom element
- Type
- object
topRoundedColumn(x, y, height, width) → {string}
- Source:
draw rounded top edges at the bars of the graph
Parameters:
Name | Type | Description |
---|---|---|
x |
object | d3 object |
y |
object | d3 object |
height |
number | svg height |
width |
number | svg width |
Returns:
coordinates of the drawn element
- Type
- string
useUserService(userId) → {object|boolean|object|boolean}
- Source:
Retrieves user information
Parameters:
Name | Type | Description |
---|---|---|
userId |
integer | user id |
Returns:
-
{isLoading, data, error} contain data request
- Type
- object
-
objectReturn.isLoading - data is loading ?
- Type
- boolean
-
objectReturn.data = { mainData:
- Type
- object
-
objectReturn.error - An error has occurred ?
- Type
- boolean