Closed wolfgangvonludwigsburg closed 7 years ago
Wow, you scared me for a minute there! The book just came out in print yesterday — how awful if I'd had a major error in the code!
You are right, of course, but this is an edge case I'm not worried about nor trying to address in this example. Also, I don't want to complicate the example by introducing a new sort of syntax.
Thanks for the suggestion, and let me know if you discover anything else!
Thanks for your reply!
Me -sure- would'nt have discovered it actually. But while studying your examples concerning "General Update Pattern", I came across to automate it ... e.g.
d3.interval( ()=>{
let what = Math.round( Math.random() )
if (what) {
//Add a data value
//...
var newNumber = ...
var lastKeyValue = ...
dataset.push({
key : lastKeyValue + 1,
value : newNumber
});
} else {
//Remove a value
dataset.shift(); //Remove one value from dataset
}
update() //= "General Update Pattern" (without transitions) ...
}, 100)
... and then wondered about the error break.
Yes, I do have some more concerns (not errors, but wishes), I'll would prepare and report them later to you ...
If you click 20 x 'Remove a data value' (hence dataset is total empty), then click 'Add a new data value', ... 01_enter_merge_exit.html:136 Uncaught TypeError: Cannot read property 'key' of undefined
Change 136: var lastKeyValue = dataset[ dataset.length -1 ].key; to:
Best Wishes, Wolfgang