Skip to content

Commit

Permalink
Make sure transitions are skipped completely when axisTransitionLength=0
Browse files Browse the repository at this point in the history
  • Loading branch information
juhoojala committed May 4, 2016
1 parent 2c7db3c commit 3e83c5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,22 @@ export default class Example extends React.Component {
if (this.state.checked) {
return this.data1;
}

return this.data2;
}

getMaxY() {
if (!this.state.checked) {
return 10;
} else {
return 6;
}
}

getCharts() {
return _.range(0, 40).map(index => (
<LineChart
key={index}
maxY={10}
maxY={this.getMaxY()}
width={200}
aspectRatio={0.8}
data={this.getData()}
Expand Down
8 changes: 5 additions & 3 deletions src/line-chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,11 @@ export default class LineChart extends React.Component {
.tickSize(-this.getScaleWidth())
.tickFormat(this.getYTickFormat());

d3.select(React.findDOMNode(this.refs.yAxis))
.transition(this.props.axisTransitionLength)
.call(yAxis);
const sel = d3.select(React.findDOMNode(this.refs.yAxis));
if (this.props.axisTransitionLength > 0) {
sel.transition(this.props.axisTransitionLength);
}
sel.call(yAxis);
}


Expand Down

0 comments on commit 3e83c5f

Please sign in to comment.