scotthmurray / d3-book

Code examples for “Interactive Data Visualization for the Web”
http://d3book.com
Other
2.4k stars 1.79k forks source link

bug existed in chapter 09 - example 28 #26

Closed bh4rtp closed 6 years ago

bh4rtp commented 6 years ago

first keeping clicking remove a data value and empty the data, and then click add a data value, it will not do work and report a bug for lastKeyValue = dataset[dataset.length - 1].key without length checking.

scotthmurray commented 6 years ago

Great catch! Though that's definitely an edge case that I don't think this example needs to address. In real life, you'd never be clicking to remove data points… This is intended just to illustrate how you could change the data set, rebind, and update. :-)