Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
iCity
EnergyDashboard
Commits
5d01b6df
Commit
5d01b6df
authored
3 years ago
by
Pithon Kabiro
Browse files
Options
Download
Email Patches
Plain Diff
Edit documentation for functions / Chart app
parent
cecb9f7d
master
aggregation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/js/appChart.js
+14
-14
public/js/appChart.js
with
14 additions
and
14 deletions
+14
-14
public/js/appChart.js
+
14
-
14
View file @
5d01b6df
...
@@ -8,8 +8,8 @@ const BASE_URL = "http://193.196.39.91:8080/frost-icity-tp31/v1.1";
...
@@ -8,8 +8,8 @@ const BASE_URL = "http://193.196.39.91:8080/frost-icity-tp31/v1.1";
/**
/**
* Create URL to fetch the Observations corresponding to a provided Datastream
* Create URL to fetch the Observations corresponding to a provided Datastream
* @param {
*
} datastreamID -
i
nteger representing the Datastream ID
* @param {
Number
} datastreamID -
I
nteger representing the Datastream ID
* @returns {String}
* @returns {String}
URL string for fetching the Observations corresponding to a Datastream
*/
*/
const
getObservationsUrl
=
function
(
datastreamID
)
{
const
getObservationsUrl
=
function
(
datastreamID
)
{
if
(
!
datastreamID
)
return
;
if
(
!
datastreamID
)
return
;
...
@@ -19,9 +19,9 @@ const getObservationsUrl = function (datastreamID) {
...
@@ -19,9 +19,9 @@ const getObservationsUrl = function (datastreamID) {
/**
/**
* Create a temporal filter string for the fetched Observations
* Create a temporal filter string for the fetched Observations
* @param {
*
} dateStart
- s
tart date in YYYY-MM-DD format
* @param {
String
} dateStart
S
tart date in YYYY-MM-DD format
* @param {
*
} dateStop
- s
top date in YYYY-MM-DD format
* @param {
String
} dateStop
S
top date in YYYY-MM-DD format
* @returns {String}
* @returns {String}
Temporal filter string
*/
*/
const
createTemporalFilterString
=
function
(
dateStart
,
dateStop
)
{
const
createTemporalFilterString
=
function
(
dateStart
,
dateStop
)
{
if
(
!
dateStart
||
!
dateStop
)
return
;
if
(
!
dateStart
||
!
dateStop
)
return
;
...
@@ -46,8 +46,8 @@ const axiosGetRequest = axios.get(BASE_URL_OBSERVATIONS, {
...
@@ -46,8 +46,8 @@ const axiosGetRequest = axios.get(BASE_URL_OBSERVATIONS, {
/**
/**
* Format the response from SensorThings API to make it suitable for heatmap
* Format the response from SensorThings API to make it suitable for heatmap
* @param {
*
} obsArray
-
Response from SensorThings API as array
* @param {
Array
} obsArray Response from SensorThings API as array
* @returns {Array}
* @returns {Array}
Array of formatted observations suitable for use in a heatmap
*/
*/
const
formatSTAResponseForHeatMap
=
function
(
obsArray
)
{
const
formatSTAResponseForHeatMap
=
function
(
obsArray
)
{
const
dataSTAFormatted
=
[];
const
dataSTAFormatted
=
[];
...
@@ -72,8 +72,8 @@ const formatSTAResponseForHeatMap = function (obsArray) {
...
@@ -72,8 +72,8 @@ const formatSTAResponseForHeatMap = function (obsArray) {
/**
/**
* Draw a heatmap using Highcharts library
* Draw a heatmap using Highcharts library
* @param {
*
} obsArray
-
Response from SensorThings API
* @param {
Array
} obsArray Response from SensorThings API
* @returns {
void}
* @returns {
Object} Highcharts library heatmap object
*/
*/
const
drawHeatMapHC
=
function
(
obsArray
)
{
const
drawHeatMapHC
=
function
(
obsArray
)
{
Highcharts
.
chart
(
"
chart-heatmap
"
,
{
Highcharts
.
chart
(
"
chart-heatmap
"
,
{
...
@@ -167,8 +167,8 @@ const drawHeatMapHC = function (obsArray) {
...
@@ -167,8 +167,8 @@ const drawHeatMapHC = function (obsArray) {
/**
/**
* Convert the observations' phenomenonTime from an ISO 8601 string to Unix epoch
* Convert the observations' phenomenonTime from an ISO 8601 string to Unix epoch
* @param {
*
} obsArray
-
Response from SensorThings API as array
* @param {
Array
} obsArray Response from SensorThings API as array
* @returns {Array}
* @returns {Array}
Array of formatted observations suitable for use in a line chart
*/
*/
const
formatSTAResponseForLineChart
=
function
(
obsArray
)
{
const
formatSTAResponseForLineChart
=
function
(
obsArray
)
{
const
dataSTAFormatted
=
[];
const
dataSTAFormatted
=
[];
...
@@ -182,8 +182,8 @@ const formatSTAResponseForLineChart = function (obsArray) {
...
@@ -182,8 +182,8 @@ const formatSTAResponseForLineChart = function (obsArray) {
/**
/**
* Draw a line chart using Highcharts library
* Draw a line chart using Highcharts library
* @param {
*
} obsArray - Response from SensorThings API
* @param {
Array
} obsArray - Response from SensorThings API
* @returns {
void}
* @returns {
Object} Highcharts library line chart object
*/
*/
const
drawLineChartHC
=
function
(
obsArray
)
{
const
drawLineChartHC
=
function
(
obsArray
)
{
// Create the chart
// Create the chart
...
@@ -217,7 +217,7 @@ const drawLineChartHC = function (obsArray) {
...
@@ -217,7 +217,7 @@ const drawLineChartHC = function (obsArray) {
* Follows "@iot.nextLink" links in SensorThingsAPI's response
* Follows "@iot.nextLink" links in SensorThingsAPI's response
* Appends new results to existing results
* Appends new results to existing results
* @async
* @async
* @param {Object} responsePromise
-
Promise object
* @param {Object} responsePromise Promise object
* @returns {Object} - Object containing results from all the "@iot.nextLink" links
* @returns {Object} - Object containing results from all the "@iot.nextLink" links
*/
*/
const
followNextLink
=
function
(
responsePromise
)
{
const
followNextLink
=
function
(
responsePromise
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets