I'm looking into making charts with D3, and stumbled upon the d3.bisector
. However, I don't understand what it is or does from the documentation.
Almost all examples that I find in the web use a Date array, similar to the example in the official documentation:
var data = [
{date: new Date(2011, 1, 1), value: 0.5},
{date: new Date(2011, 2, 1), value: 0.6},
{date: new Date(2011, 3, 1), value: 0.7},
{date: new Date(2011, 4, 1), value: 0.8}
];
var bisect = d3.bisector(function(d) { return d.date; }).right;
So what does the bisector do, besides picking the date object from the array elements? What does the *.right
return?
And is it of any use if I have a simple 1-dimensional array, like var data = [3, 6, 2, 7, 5, 4, 8]
?
Thanks for enlightening me.