From 33164e577350677eec564c866024ccea7c460bc1 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Sat, 14 Mar 2015 23:19:25 +0700 Subject: [PATCH] Always show a bar if there is a value --- app/scripts/src/charts/bar_chart.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/scripts/src/charts/bar_chart.jsx b/app/scripts/src/charts/bar_chart.jsx index 3abaaf6..b0e57e1 100644 --- a/app/scripts/src/charts/bar_chart.jsx +++ b/app/scripts/src/charts/bar_chart.jsx @@ -232,7 +232,8 @@ var Bar = React.createClass({ } this.setState({ - labelX: labelX + labelX: labelX, + barWidth: (this.props.item && this.props.width < 5 ? 5 : this.props.width) }, this.animateAll); }, @@ -245,7 +246,7 @@ var Bar = React.createClass({ this.clearAnimations(bar); this.clearAnimations(underlay); this.clearAnimations(text); - this.animate(bar, 'width', this.state.lastBarWidth, this.props.width); + this.animate(bar, 'width', this.state.lastBarWidth, this.state.barWidth); this.animate(bar, 'x', this.state.lastBarX, this.props.x); this.animate(underlay, 'x', this.state.lastLabelX - padH, this.state.labelX - padH); this.animate(text, 'x', this.state.lastLabelX, this.state.labelX); @@ -258,9 +259,9 @@ var Bar = React.createClass({ barX = (this.state.lastBarX && this.state.lastBarX !== this.props.x ? this.state.lastBarX : this.props.x), - barWidth = (this.state.lastBarWidth && this.state.lastBarWidth !== this.props.width + barWidth = (this.state.lastBarWidth && this.state.lastBarWidth !== this.state.barWidth ? this.state.lastBarWidth - : this.props.width); + : this.state.barWidth); return (