diff --git a/assets/src/scripts/components/hydrograph/index.js b/assets/src/scripts/components/hydrograph/index.js index 202de488a71ffeaf545982ecd406b0c102b61968..ccf2b3b764f5c2f21c214b45794dc981e64a3ddf 100644 --- a/assets/src/scripts/components/hydrograph/index.js +++ b/assets/src/scripts/components/hydrograph/index.js @@ -502,15 +502,6 @@ export const attachToNode = function (store, node, {siteno, parameter, compare, return; } - if (compare) { - store.dispatch(Actions.toggleTimeSeries('compare', true)); - } - - // If specified, initialize the cursorOffset - if (cursorOffset !== undefined) { - store.dispatch(Actions.setCursorOffset(cursorOffset)); - } - store.dispatch(Actions.resizeUI(window.innerWidth, node.offsetWidth)); select(node) .call(provide(store)) @@ -523,6 +514,16 @@ export const attachToNode = function (store, node, {siteno, parameter, compare, sizeClass: () => 'fa-3x' }))); + // If specified, turn the visibility of the comparison time series on. + if (compare) { + store.dispatch(Actions.toggleTimeSeries('compare', true)); + } + + // If specified, initialize the cursorOffset + if (cursorOffset !== undefined) { + store.dispatch(Actions.setCursorOffset(cursorOffset)); + } + select(node).select('.graph-container') .call(link(controlDisplay, hasTimeSeriesWithPoints('current', 'P7D'))) .call(timeSeriesGraph, siteno) diff --git a/assets/src/scripts/store/time-series-state-reducer.js b/assets/src/scripts/store/time-series-state-reducer.js index bcdaf67ab2bca3b04f1b17aad0cc92647b1c20d7..4c383b300fe9d00cbc821765fc942ab81b21134c 100644 --- a/assets/src/scripts/store/time-series-state-reducer.js +++ b/assets/src/scripts/store/time-series-state-reducer.js @@ -69,7 +69,7 @@ const removeLoadingTimeSeries = function(timeSeriesState, action) { }; }; -const setRequestedTimeRange = function(timeSeriesState, action) { +const requestedTimeRange = function(timeSeriesState, action) { return { ...timeSeriesState, requestedTimeRange: {startDT: action.startTime, endDT: action.endTime} @@ -90,7 +90,7 @@ export const timeSeriesStateReducer = function(timeSeriesState={}, action) { case 'TIME_SERIES_PLAY_STOP': return timeSeriesPlayStop(timeSeriesState, action); case 'TIME_SERIES_LOADING_ADD': return addLoadingTimeSeries(timeSeriesState, action); case 'TIME_SERIES_LOADING_REMOVE': return removeLoadingTimeSeries(timeSeriesState, action); - case 'SET_CUSTOM_DATE_RANGE': return setRequestedTimeRange(timeSeriesState, action); + case 'SET_CUSTOM_DATE_RANGE': return requestedTimeRange(timeSeriesState, action); default: return timeSeriesState; } }; diff --git a/graph-server/package.json b/graph-server/package.json index bff1a5079182a7a63ccd79a931d6d094c21ac5bd..0d210fdb1756e4d181fa31a4b3a3b25534e294aa 100644 --- a/graph-server/package.json +++ b/graph-server/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "nyc jasmine", "start": "DEBUG=express:* node src/index.js", - "watch": "STATIC_ROOT=http://localhost:9000 DEBUG=express:* nodemon src" + "watch": "STATIC_ROOT=http://localhost:9000 nodemon src" }, "engines": { "node": "12.13.1"