Browse Source

fallback on empty string

master
Valentin D. Pinkman 7 years ago
parent
commit
14686803cb
No known key found for this signature in database GPG Key ID: E7D110669FFB8D3E
  1. 4
      src/components/BalanceSummary/index.js
  2. 4
      src/components/base/Chart/index.js
  3. 2
      src/components/base/Chart/refreshDraw.js

4
src/components/BalanceSummary/index.js

@ -61,7 +61,9 @@ const BalanceSummary = ({
currency={counterValue}
tickXScale={selectedTime}
renderTickY={(val, account) =>
account ? formatCurrencyUnit(account.unit, val) : val
account
? formatCurrencyUnit(account.unit, val)
: formatCurrencyUnit(counterValue.units[0], val)
}
renderTooltip={
isAvailable && !account

4
src/components/base/Chart/index.js

@ -59,7 +59,7 @@ export type Props = {
dateFormat?: string, // eslint-disable-line react/no-unused-prop-types
isInteractive?: boolean, // eslint-disable-line react/no-unused-prop-types
renderTooltip?: Function, // eslint-disable-line react/no-unused-prop-types
renderTickY?: (t: number, account: Account) => mixed, // eslint-disable-line react/no-unused-prop-types
renderTickY?: (t: number, account: ?Account) => mixed, // eslint-disable-line react/no-unused-prop-types
}
class Chart extends PureComponent<Props> {
@ -72,7 +72,7 @@ class Chart extends PureComponent<Props> {
isInteractive: true,
tickXScale: 'month',
renderTickY: (t: number, account: Account): mixed =>
account ? formatShort(account.unit, t) : t,
account ? formatShort(account.unit, t) : '',
}
componentDidMount() {

2
src/components/base/Chart/refreshDraw.js

@ -87,7 +87,7 @@ export default function refreshDraw({ ctx, props }: { ctx: CTX, props: Props })
d3
.axisLeft(y)
.ticks(3)
.tickFormat(val => (renderTickY && account ? renderTickY(val, account) : val)),
.tickFormat(val => renderTickY(val, account)),
)
NODES.axisBot.call(
d3

Loading…
Cancel
Save