Skip to content

Instantly share code, notes, and snippets.

@lpadukana
Created April 27, 2016 22:13
Show Gist options
  • Select an option

  • Save lpadukana/e6bc540f9c2cd73cc8fdeb8798280436 to your computer and use it in GitHub Desktop.

Select an option

Save lpadukana/e6bc540f9c2cd73cc8fdeb8798280436 to your computer and use it in GitHub Desktop.
update() {
// console.log(this.dataset);
this.xScale.domain(d3.extent(this.dataset, d => new Date(+d.x)));
this.yScale.domain([0, d3.max(this.dataset, d => +d.y)]);
d3.transition()
.duration(500)
.each(() => {
this.svg.selectAll("g.x.axis").call(this.xAxis);
this.svg.selectAll("g.y.axis").call(this.yAxis);
this.path.transition().attr('d', this.line);
})
.transition()
.each(() => {
this.path.data([this.dataset]);
this.path.transition().attr('d', this.line);
});
this.path.exit()
.remove();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment