Custom Bisectors

D3 allows us to create custom bisector functions that search for items in an array.

We'll cover the following

We are going to create a custom bisector function. D3 comes with a bisect() function, but it is only capable of comparing numbers. We need to compare dates. Luckily, D3 comes with a function for creating a custom bisector for searching through an array with non-numeric values. We’re going to continue working on the event handler function.

Creating a custom bisector

Inside the function, we are going to replace the index variable.

Get hands-on with 1400+ tech skills courses.