Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
iCity
EnergyDashboard
Commits
b81e04f1
Commit
b81e04f1
authored
Jun 24, 2021
by
Pithon Kabiro
Browse files
Minor tweaks to functions
parent
05f9d528
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/js/appChart.js
View file @
b81e04f1
...
@@ -125,6 +125,7 @@ export const PARAM_SELECT = "result,phenomenonTime";
...
@@ -125,6 +125,7 @@ export const PARAM_SELECT = "result,phenomenonTime";
* @returns {Array} Array of formatted observations suitable for use in a heatmap
* @returns {Array} Array of formatted observations suitable for use in a heatmap
*/
*/
export
const
formatSTAResponseForHeatMap
=
function
(
obsArray
)
{
export
const
formatSTAResponseForHeatMap
=
function
(
obsArray
)
{
if
(
!
obsArray
)
return
;
const
dataSTAFormatted
=
[];
const
dataSTAFormatted
=
[];
obsArray
.
forEach
((
obs
)
=>
{
obsArray
.
forEach
((
obs
)
=>
{
// Get the date/time string; first element in input array; remove trailing "Z"
// Get the date/time string; first element in input array; remove trailing "Z"
...
@@ -246,6 +247,7 @@ export const drawHeatMapHC = function (formattedObsArrayForHeatmap) {
...
@@ -246,6 +247,7 @@ export const drawHeatMapHC = function (formattedObsArrayForHeatmap) {
* @returns {Array} Array of formatted observations suitable for use in a line chart
* @returns {Array} Array of formatted observations suitable for use in a line chart
*/
*/
export
const
formatSTAResponseForLineChart
=
function
(
obsArray
)
{
export
const
formatSTAResponseForLineChart
=
function
(
obsArray
)
{
if
(
!
obsArray
)
return
;
const
dataSTAFormatted
=
[];
const
dataSTAFormatted
=
[];
obsArray
.
forEach
((
result
)
=>
{
obsArray
.
forEach
((
result
)
=>
{
const
timestampObs
=
new
Date
(
result
[
0
].
slice
(
0
,
-
1
)).
getTime
();
// slice() removes trailing "Z" character in timestamp
const
timestampObs
=
new
Date
(
result
[
0
].
slice
(
0
,
-
1
)).
getTime
();
// slice() removes trailing "Z" character in timestamp
...
@@ -302,6 +304,7 @@ export const drawLineChartHC = function (formattedObsArrayForLineChart) {
...
@@ -302,6 +304,7 @@ export const drawLineChartHC = function (formattedObsArrayForLineChart) {
* @returns {Object} - Object containing results from all the "@iot.nextLink" links
* @returns {Object} - Object containing results from all the "@iot.nextLink" links
*/
*/
export
const
followNextLink
=
function
(
responsePromise
)
{
export
const
followNextLink
=
function
(
responsePromise
)
{
if
(
!
responsePromise
)
return
;
return
responsePromise
return
responsePromise
.
then
(
function
(
lastSuccess
)
{
.
then
(
function
(
lastSuccess
)
{
if
(
lastSuccess
.
data
[
"
@iot.nextLink
"
])
{
if
(
lastSuccess
.
data
[
"
@iot.nextLink
"
])
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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