Commit c2257bdf authored by Mike Greiling's avatar Mike Greiling

allow burndown chart to resize during animations

parent e2c39ec9
......@@ -120,4 +120,18 @@ export default class BurndownChart {
this.idealLinePath.datum(this.idealData).attr('d', this.line);
}
}
animate(seconds = 5) {
this.ticksLeft = this.ticksLeft || 0;
if (this.ticksLeft <= 0) {
const interval = setInterval(() => {
this.ticksLeft -= 1;
if (this.ticksLeft <= 0) {
clearInterval(interval);
}
this.resize();
}, 20);
}
this.ticksLeft = seconds * 50;
}
}
......@@ -18,5 +18,6 @@ $(() => {
});
chart.setData(testData);
window.addEventListener('resize', () => chart.resize());
window.addEventListener('resize', () => chart.animate(1));
$(document).on('click', '.js-sidebar-toggle', () => chart.animate(2));
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment