Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
waterdataui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Water Mission Area
Internet of Water
waterdataui
Commits
1087aa12
Commit
1087aa12
authored
2 years ago
by
Briggs, Aaron Shane
Browse files
Options
Downloads
Patches
Plain Diff
streamline some functions
parent
158df34e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!388
WDFN-732 Plot Secondary Time Series - graph the time series
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.js
+21
-19
21 additions, 19 deletions
...toring-location/components/hydrograph/selectors/domain.js
with
21 additions
and
19 deletions
assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.js
+
21
−
19
View file @
1087aa12
...
...
@@ -177,6 +177,13 @@ export const getFullArrayOfAdditionalTickMarks = function(tickValues, yDomain) {
return
Array
.
from
(
new
Set
(
additionalTickValues
.
concat
(
tickValues
)));
};
/**
* Redux selector function to find the maximum and minimum of all data values displayed on the primary y-axis. Information
* which can then be used to determine the correct values for numbering the tick marks of the primary y-axis.
* @return {Array} An array with two values representing the lowest and highest values for the primary
* y-axis. Defaults to a range of 0 to 1 if there are no values.
*/
export
const
getPrimaryValueRange
=
createSelector
(
isVisible
(
'
compare
'
),
isVisible
(
'
median
'
),
...
...
@@ -187,7 +194,6 @@ export const getPrimaryValueRange = createSelector(
getPrimaryParameter
,
(
showCompare
,
showMedian
,
primaryRange
,
compareRange
,
medianRange
,
gwLevelsRange
,
parameter
)
=>
{
const
valueExtent
=
[];
let
result
=
[
0
,
1
];
if
(
primaryRange
)
{
valueExtent
.
push
(...
primaryRange
);
}
...
...
@@ -200,30 +206,26 @@ export const getPrimaryValueRange = createSelector(
if
(
showMedian
&&
medianRange
)
{
valueExtent
.
push
(...
medianRange
);
}
if
(
valueExtent
.
length
)
{
result
=
[
Math
.
min
(...
valueExtent
),
Math
.
max
(...
valueExtent
)];
// Add padding to the extent and handle empty data sets.
result
=
extendDomain
(
result
,
useSymlog
(
parameter
));
}
return
result
;
return
valueExtent
.
length
?
extendDomain
([
Math
.
min
(...
valueExtent
),
Math
.
max
(...
valueExtent
)],
useSymlog
(
parameter
))
:
[
0
,
1
];
}
);
/**
* Redux selector function to find the maximum and minimum of all data values displayed on the secondary y-axis. Information
* which can then be used to determine the correct values for numbering the tick marks of the secondary y-axis.
* @return {Array} secondaryYAxisDomain - array with two values, representing the lowest and highest values for the secondary
* y-axis. Defaults to a range of 0 to 1 if there are no values.
*/
export
const
getSecondaryValueRange
=
createSelector
(
getIVDataRange
(
'
secondary
'
),
getIVParameter
(
'
secondary
'
),
(
secondaryParameterRange
,
secondaryParameter
)
=>
{
let
result
=
[
0
,
1
];
if
(
secondaryParameterRange
)
{
result
=
[
Math
.
min
(...
secondaryParameterRange
),
Math
.
max
(...
secondaryParameterRange
)];
// Add padding to the extent and handle empty data sets.
result
=
extendDomain
(
secondaryParameterRange
,
useSymlog
(
secondaryParameter
));
}
return
result
;
return
secondaryParameterRange
?
extendDomain
([
Math
.
min
(...
secondaryParameterRange
),
Math
.
max
(...
secondaryParameterRange
)],
useSymlog
(
secondaryParameter
))
:
[
0
,
1
];
}
);
...
...
@@ -240,10 +242,10 @@ const getYTickDetails = memoize(tickKind => createSelector(
getPrimaryParameter
,
getSecondaryValueRange
,
getIVParameter
(
'
secondary
'
),
(
primaryDomain
,
primaryParameter
,
secondaryYDomain
,
S
econdaryParameter
)
=>
{
(
primaryDomain
,
primaryParameter
,
secondaryYDomain
,
s
econdaryParameter
)
=>
{
const
parameter
=
tickKind
===
'
prim
ary
'
?
prim
aryParameter
:
Second
aryParameter
;
const
yDomain
=
tickKind
===
'
prim
ary
'
?
prim
aryDomain
:
second
ary
Y
Domain
;
const
parameter
=
tickKind
===
'
second
ary
'
?
second
aryParameter
:
prim
aryParameter
;
const
yDomain
=
tickKind
===
'
second
ary
'
?
second
ary
Y
Domain
:
prim
aryDomain
;
let
tickValues
=
ticks
(
yDomain
[
0
],
yDomain
[
1
],
Y_TICK_COUNT
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment