Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • E EnergyDashboard
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • iCity
  • EnergyDashboard
  • Merge requests
  • !18

Update logic for drop-down list

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Pithon Kabiro requested to merge wip_select-sensors-dropdown-list-7 into master 3 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 10

Deactivate 'draw chart' button during async task. In addition, improve legibilty by replacing multiple if's with 'case' statement

  • Pithon Kabiro @pithon.kabiro assigned to @pithon.kabiro 3 years ago

    assigned to @pithon.kabiro

  • Pithon Kabiro @pithon.kabiro mentioned in commit e02c4e2a 3 years ago

    mentioned in commit e02c4e2a

  • Pithon Kabiro @pithon.kabiro merged 3 years ago

    merged

  • Loading
  • Loading
  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • master (base)

and
  • latest version
    559e7982
    1 commit, 3 years ago

10 files
+ 243
- 162

    Preferences

    File browser
    Compare changes
publ‎ic/js‎
src_m‎odules‎
aggreg‎ate.mjs‎ +38 -10
chartCo‎lumn.mjs‎ +5 -4
chartHea‎tmap.mjs‎ +4 -3
chartL‎ine.mjs‎ +2 -2
chartScatt‎erPlot.mjs‎ +2 -2
dropDownLis‎tHelpers.mjs‎ +2 -0
dropDownListP‎rocessing.mjs‎ +2 -0
loadingInd‎icator.mjs‎ +26 -3
third‎party‎
scrip‎ts.js‎ +24 -19
appCh‎art.js‎ +138 -119
public/js/src_modules/aggregate.mjs
+ 38
- 10
  • View file @ 559e7982

  • Edit in single-file editor

  • Open in Web IDE


@@ -5,6 +5,16 @@ import {
extractObservationValuesWithinMonthInterval,
} from "./aggregateHelpers.mjs";
/**
* Remove `null` observation values from an array of observation values
*
* @param {Array} obsValuesArr An array of observation values
* @returns {Array} An array with `null` observation values removed
*/
const filterOutNullObservationValues = function (obsValuesArr) {
return obsValuesArr.filter((obs) => obs !== null);
};
/**
* Calculate the minimum observation values that fall within a time interval delimited by a start date and end date
* @param {Array} obsValuesForDaysIntervalArr An array of observation values that fall within our time interval
@@ -13,7 +23,10 @@ import {
const calculateMinimumObservationValuesWithinDatesInterval = function (
obsValuesForDaysIntervalArr
) {
return Math.min(...obsValuesForDaysIntervalArr);
// If the observation value is `null`, skip the calculation
return obsValuesForDaysIntervalArr.reduce((previousValue, obsValue) =>
obsValue === null ? null : Math.min(previousValue, obsValue)
);
};
/**
@@ -24,7 +37,10 @@ const calculateMinimumObservationValuesWithinDatesInterval = function (
const calculateMaximumObservationValuesWithinDatesInterval = function (
obsValuesForDaysIntervalArr
) {
return Math.max(...obsValuesForDaysIntervalArr);
// If the observation value is `null`, skip the calculation
return obsValuesForDaysIntervalArr.reduce((previousValue, obsValue) =>
obsValue === null ? null : Math.max(previousValue, obsValue)
);
};
/**
@@ -35,8 +51,10 @@ const calculateMaximumObservationValuesWithinDatesInterval = function (
const calculateSumOfObservationValuesWithinDatesInterval = function (
obsValuesForDaysIntervalArr
) {
return obsValuesForDaysIntervalArr.reduce(
(accumulator, obsValue) => accumulator + obsValue
// Remove the `null` observation values before calculating the sum
return filterOutNullObservationValues(obsValuesForDaysIntervalArr).reduce(
(previousValue, obsValue) => previousValue + obsValue,
0
);
};
@@ -48,10 +66,11 @@ const calculateSumOfObservationValuesWithinDatesInterval = function (
const calculateAverageOfObservationValuesWithinDatesInterval = function (
obsValuesForDaysIntervalArr
) {
// The observation values array should only include non-`null` values
return (
calculateSumOfObservationValuesWithinDatesInterval(
obsValuesForDaysIntervalArr
) / obsValuesForDaysIntervalArr.length
) / filterOutNullObservationValues(obsValuesForDaysIntervalArr).length
);
};
@@ -63,7 +82,10 @@ const calculateAverageOfObservationValuesWithinDatesInterval = function (
const calculateMinimumObservationValuesWithinMonthInterval = function (
obsValuesForMonthIntervalArr
) {
return Math.min(...obsValuesForMonthIntervalArr);
// If the observation value is `null`, skip the calculation
return obsValuesForMonthIntervalArr.reduce((previousValue, obsValue) =>
obsValue === null ? null : Math.min(previousValue, obsValue)
);
};
/**
@@ -74,7 +96,10 @@ const calculateMinimumObservationValuesWithinMonthInterval = function (
const calculateMaximumObservationValuesWithinMonthInterval = function (
obsValuesForMonthIntervalArr
) {
return Math.max(...obsValuesForMonthIntervalArr);
// If the observation value is `null`, skip the calculation
return obsValuesForMonthIntervalArr.reduce((previousValue, obsValue) =>
obsValue === null ? null : Math.max(previousValue, obsValue)
);
};
/**
@@ -85,8 +110,10 @@ const calculateMaximumObservationValuesWithinMonthInterval = function (
const calculateSumOfObservationValuesWithinMonthInterval = function (
obsValuesForMonthIntervalArr
) {
return obsValuesForMonthIntervalArr.reduce(
(accumulator, obsValue) => accumulator + obsValue
// Remove the `null` observation values before calculating the sum
return filterOutNullObservationValues(obsValuesForMonthIntervalArr).reduce(
(previousValue, obsValue) => previousValue + obsValue,
0
);
};
@@ -98,10 +125,11 @@ const calculateSumOfObservationValuesWithinMonthInterval = function (
const calculateAverageOfObservationValuesWithinMonthInterval = function (
obsValuesForMonthIntervalArr
) {
// The observation values array should only include non-`null` values
return (
calculateSumOfObservationValuesWithinMonthInterval(
obsValuesForMonthIntervalArr
) / obsValuesForMonthIntervalArr.length
) / filterOutNullObservationValues(obsValuesForMonthIntervalArr).length
);
};
public/js/src_modules/chartColumn.mjs
+ 5
- 4
  • View file @ 559e7982

  • Edit in single-file editor

  • Open in Web IDE


@@ -131,10 +131,12 @@ const drawColumnChartHighcharts = function (
title: {
text: textChartTitle,
"align": "center",
},
subtitle: {
text: textChartSubtitle,
"align": "center",
},
xAxis: {
@@ -143,7 +145,6 @@ const drawColumnChartHighcharts = function (
},
yAxis: {
min: 0,
title: {
text: `${phenomenonName} [${unitOfMeasurementSymbol}]`,
},
@@ -155,10 +156,10 @@ const drawColumnChartHighcharts = function (
// this.x -- common for all points
// this.points -- an array containing properties for each series
// Note that our `reduce` method is in this format:
// ((accumulator, currentValue, currentIndex) => {...}, initialValue)
// ((previousValue, currentValue, currentIndex) => {...}, initialValue)
return this.points.reduce(
(accumulator, point, i) =>
`${accumulator} <br/> <span style="color:${point.color}">${
(previousValue, point, i) =>
`${previousValue} <br/> <span style="color:${point.color}">${
point.series.name
}</span>: <b>${point.y.toFixed(2)} ${
unitOfMeasurementSymbolsArr[i]
public/js/src_modules/chartHeatmap.mjs
+ 4
- 3
  • View file @ 559e7982

  • Edit in single-file editor

  • Open in Web IDE


@@ -48,7 +48,8 @@ const calculateMinMaxValuesForHeatmapColorAxis = function (
const maxValue = Math.trunc(Math.max(...obsValueArr));
// Calculate the closest multiple of 5
const minObsValue = minValue - (minValue % 5);
const minObsValue =
minValue > 0 ? minValue - (minValue % 5) : minValue + (minValue % 5);
const maxObsValue = maxValue + (5 - (maxValue % 5));
return { minObsValue, maxObsValue };
@@ -98,13 +99,13 @@ const drawHeatMapHighcharts = function (
title: {
text: TEXT_CHART_TITLE,
align: "left",
align: "center",
x: 40,
},
subtitle: {
text: TEXT_CHART_SUBTITLE,
align: "left",
align: "center",
x: 40,
},
public/js/src_modules/chartLine.mjs
+ 2
- 2
  • View file @ 559e7982

  • Edit in single-file editor

  • Open in Web IDE


@@ -134,12 +134,12 @@ const drawLineChartHighcharts = function (
title: {
text: textChartTitle,
"align": "left",
"align": "center",
},
subtitle: {
text: textChartSubtitle,
align: "left",
align: "center",
},
tooltip: {
public/js/src_modules/chartScatterPlot.mjs
+ 2
- 2
  • View file @ 559e7982

  • Edit in single-file editor

  • Open in Web IDE


@@ -231,12 +231,12 @@ const drawScatterPlotHighcharts = function (
title: {
text: CHART_TITLE,
"align": "left",
"align": "center",
},
subtitle: {
text: CHART_SUBTITLE,
"align": "left",
"align": "center",
},
xAxis: {
Assignee
Pithon Kabiro's avatar
Pithon Kabiro
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Pithon Kabiro
Reference: icity/energydashboard!18
Source branch: wip_select-sensors-dropdown-list-7

Menu

Explore Projects Groups Snippets

Dies ist die Gitlab-Instanz des Transferportals der Hochschule für Technik Stuttgart. Hier geht es zurück zum Portal