diff --git a/src/components/BalanceSummary/index.js b/src/components/BalanceSummary/index.js index f0edf2b5..d17c6bcb 100644 --- a/src/components/BalanceSummary/index.js +++ b/src/components/BalanceSummary/index.js @@ -80,7 +80,9 @@ const BalanceSummary = ({ fiat={counterValue} val={d.value} /> - {d.date.toISOString().substr(0, 10)} + + {d.date.toISOString().substr(0, 10)} + ) : null diff --git a/src/components/CalculateBalance.js b/src/components/CalculateBalance.js index 7c4337ce..4f430e45 100644 --- a/src/components/CalculateBalance.js +++ b/src/components/CalculateBalance.js @@ -26,10 +26,18 @@ type Props = OwnProps & { const mapStateToProps = (state: State, props: OwnProps) => { const counterValueCurrency = counterValueCurrencySelector(state) let isAvailable = true + + // create array of original values, used to reconciliate + // with counter values after calculation + const originalValues = [] + const balanceHistory = getBalanceHistorySum( props.accounts, props.daysCount, (account, value, date) => { + // keep track of original value + originalValues.push(value) + const cv = CounterValues.calculateSelector(state, { value, date, @@ -44,6 +52,12 @@ const mapStateToProps = (state: State, props: OwnProps) => { return cv }, ) + + // reconciliate balance history with original values + balanceHistory.forEach((item, i) => { + item.originalValue = originalValues[i] || 0 + }) + return { isAvailable, balanceHistory, diff --git a/src/components/CounterValue/index.js b/src/components/CounterValue/index.js index 4b46b8a9..1874ee01 100644 --- a/src/components/CounterValue/index.js +++ b/src/components/CounterValue/index.js @@ -49,7 +49,9 @@ const mapStateToProps = (state: State, props: OwnProps) => { class CounterValue extends PureComponent { render() { const { value, counterValueCurrency, date, ...props } = this.props - if (!value && value !== 0) return null + if (!value && value !== 0) { + return null + } return ( - - + {item.date.toISOString().substr(0, 10)} diff --git a/src/components/base/Chart/handleMouseEvents.js b/src/components/base/Chart/handleMouseEvents.js index b30c7742..9809b066 100644 --- a/src/components/base/Chart/handleMouseEvents.js +++ b/src/components/base/Chart/handleMouseEvents.js @@ -100,7 +100,7 @@ export default function handleMouseEvents({ NODES.xBar .attr('x1', x(d.parsedDate)) .attr('x2', x(d.parsedDate)) - .attr('y1', 0) + .attr('y1', -30) // ensure that xbar is covered .attr('y2', HEIGHT) }