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
91b9dc0d
Commit
91b9dc0d
authored
3 years ago
by
Pithon Kabiro
Browse files
Options
Download
Email Patches
Plain Diff
Edit function: chart type selection callback
parent
6db57cbe
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/js/dropDownList.js
+28
-11
public/js/dropDownList.js
with
28 additions
and
11 deletions
+28
-11
public/js/dropDownList.js
+
28
-
11
View file @
91b9dc0d
...
...
@@ -173,6 +173,13 @@ const getSelectedOptionsFromDropDownLists = function () {
"
#drop-down--sampling-rate
"
).
value
;
if
(
selectedBuilding
===
"
--Select--
"
||
selectedSensor
===
""
||
selectedSamplingRate
===
""
)
return
;
return
[
selectedBuilding
,
selectedSensor
,
selectedSamplingRate
];
};
...
...
@@ -223,10 +230,12 @@ const getBuildingSensorSamplingRateAbbreviation = function (
return
[
buildingAbbrev
,
phenomenonAbbrev
,
samplingRateAbbrev
];
};
const
runFromOptionThree
=
async
function
()
{
const
selectChartTypeFromDropDown
=
async
function
()
{
try
{
const
selectedOptions
=
getSelectedOptionsFromDropDownLists
();
if
(
selectedOptions
===
undefined
)
return
;
const
abbreviationsArr
=
getBuildingSensorSamplingRateAbbreviation
(
...
selectedOptions
);
...
...
@@ -235,6 +244,12 @@ const runFromOptionThree = async function () {
...
abbreviationsArr
);
const
selectedChartType
=
document
.
querySelector
(
"
#drop-down--chart-type
"
).
value
;
if
(
selectedChartType
===
"
--Select--
"
)
return
;
const
URL_DATASTREAM
=
getDatastreamUrl
(
BASE_URL
,
selectedDatastream
);
const
URL_OBSERVATIONS
=
getObservationsUrl
(
BASE_URL
,
selectedDatastream
);
...
...
@@ -255,15 +270,17 @@ const runFromOptionThree = async function () {
const
combinedObs
=
metadataPlusObservations
[
0
];
const
datastreamMetadata
=
metadataPlusObservations
[
1
];
drawLineChartHC
(
formatSTAResponseForLineChart
(
combinedObs
),
formatDatastreamMetadataForChart
(
datastreamMetadata
)
);
drawHeatMapHC
(
formatSTAResponseForHeatMap
(
combinedObs
),
formatDatastreamMetadataForChart
(
datastreamMetadata
)
);
if
(
selectedChartType
===
"
Line
"
)
{
drawLineChartHC
(
formatSTAResponseForLineChart
(
combinedObs
),
formatDatastreamMetadataForChart
(
datastreamMetadata
)
);
}
else
if
(
selectedChartType
===
"
Heatmap
"
)
{
drawHeatMapHC
(
formatSTAResponseForHeatMap
(
combinedObs
),
formatDatastreamMetadataForChart
(
datastreamMetadata
)
);
}
}
catch
(
err
)
{
console
.
error
(
err
);
}
...
...
@@ -271,4 +288,4 @@ const runFromOptionThree = async function () {
document
.
querySelector
(
"
#drop-down--chart-type
"
)
.
addEventListener
(
"
change
"
,
runFromOptionThree
);
.
addEventListener
(
"
change
"
,
selectChartTypeFromDropDown
);
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