From ddca4522df66fc8a4528a6b9d3e08883ea6a924a Mon Sep 17 00:00:00 2001 From: Aaron Briggs <abriggs@contractor.usgs.gov> Date: Mon, 11 Jul 2022 16:06:30 -0500 Subject: [PATCH] second line graphing --- .../components/hydrograph/selectors/iv-data.js | 4 ++++ .../components/hydrograph/time-series-graph.js | 10 +++++++++- .../components/hydrograph/time-series-lines.js | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/iv-data.js b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/iv-data.js index 63e9fec97..eb32130cc 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/iv-data.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/iv-data.js @@ -268,6 +268,10 @@ export const getIVDataSegments = memoize(dataKind => createSelector( previousDate = point.dateTime; }); segments.push(newSegment); + if (dataKind === 'secondary') { + console.log('in iv data with secondary segments ', segments); + } + return segments; } )); diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/time-series-graph.js b/assets/src/scripts/monitoring-location/components/hydrograph/time-series-graph.js index 831ac768e..dc9cbd390 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/time-series-graph.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/time-series-graph.js @@ -19,7 +19,7 @@ import {getGroundwaterLevelPoints} from './selectors/discrete-data'; import {getFloodLevelData} from './selectors/flood-level-data'; import {getIVDataSegments, HASH_ID} from './selectors/iv-data'; import {getMainLayout} from './selectors/layout'; -import {getMainXScale, getMainYScale} from './selectors/scales'; +import {getMainXScale, getMainYScale, getSecondaryYScale} from './selectors/scales'; import { getTitle, getDescription, @@ -227,6 +227,14 @@ export const drawTimeSeriesGraphData = function(elem, store, showTooltip) { yScale: getMainYScale, enableClip: () => true }))) + .call(link(store, drawDataSegments, createStructuredSelector({ + visible: isVisible('secondary'), + segments: getIVDataSegments('secondary'), + dataKind: () => 'secondary', + xScale: getMainXScale('current'), + yScale: getSecondaryYScale('MAIN'), + enableClip: () => true + }))) .call(link(store, drawDataSegments, createStructuredSelector({ visible: isVisible('compare'), segments: getIVDataSegments('compare'), diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/time-series-lines.js b/assets/src/scripts/monitoring-location/components/hydrograph/time-series-lines.js index f9c6d3028..d4e094df0 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/time-series-lines.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/time-series-lines.js @@ -68,6 +68,10 @@ const drawMaskSegment = function(group, {segment, dataKind, xScale, yScale}) { * @param {D3 scale} yScale */ const drawDataSegment = function(group, {segment, dataKind, xScale, yScale}) { + if (dataKind === 'secondary') { + console.log('drawDataSegment dataKind secondary with segments', segment); + } + if (segment.isMasked) { drawMaskSegment(group, {segment, dataKind, xScale, yScale}); } else { -- GitLab