diff --git a/web/pgadmin/dashboard/static/js/Graphs.jsx b/web/pgadmin/dashboard/static/js/Graphs.jsx index ac1c1605f..43333fe71 100644 --- a/web/pgadmin/dashboard/static/js/Graphs.jsx +++ b/web/pgadmin/dashboard/static/js/Graphs.jsx @@ -82,21 +82,14 @@ export function statsReducer(state, action) { } Object.keys(action.incoming).forEach(label => { - if(state[label]) { - if(state[label].length >= X_AXIS_LENGTH) { - state[label].unshift(); - } - newState[label] = [ - action.counter ? action.incoming[label] - action.counterData[label] : action.incoming[label], - ...state[label], - ]; - } else { - newState[label] = [ - action.counter ? action.incoming[label] - action.counterData[label] : action.incoming[label], - ]; + let newEle = action.counter ? action.incoming[label] - action.counterData[label] : action.incoming[label]; + state[label] = state[label] || []; + if(state[label].length >= X_AXIS_LENGTH) { + state[label].pop(); } + state[label].unshift(newEle); }); - return newState; + return state; } const chartsDefault = { @@ -263,6 +256,7 @@ export function GraphsWrapper(props) { const toStatsLegendRef = useRef(); const bioStatsLegendRef = useRef(); const options = useMemo(()=>({ + normalized: true, legendCallback: legendCallback, animation: { duration: 0, @@ -385,4 +379,4 @@ GraphsWrapper.propTypes = { showTooltip: PropTypes.bool.isRequired, showDataPoints: PropTypes.bool.isRequired, isDatabase: PropTypes.bool.isRequired, -}; \ No newline at end of file +};