Skip to content

BSP

The BSP is a renderless component that creates a Binary Space Parition of the provided points that can be used for quick querying such as needed by tooltips.

If either of props.ignoreXValues or props.ignoreYValues is true, then BSP will fall back to a 1-dimensional BTree over whichever axis isn't ignored. Then the default slot will receive points that are near the mouse, ignoring the correct dimension.

If neither axis is ignored, then a 2-dimensional KDTree will be used.

See the LinePlot docs for an example

Props

nametypedefaultrequireddescription
screenPointsNumericPointN/A🗹screen points
ignoreXValuesbooleanfalseWhen true, builds a BTree over Y axis values, and only searches for nearestPoints on the Y axis
ignoreYValuesbooleanfalseWhen true, builds a BTree over X axis values, and only searches for nearestPoints on the X axis
pointsPoint[][]The points in data-space over which the BSP index will be built
trackNearestPointbooleantrueWhen true, the default slot's nearestPoint prop will be updated based on mouse location

Slots

default

The default slot will have access to the built screenspace index

proptypecomment
screenPointsPoint[]all points (after decimation) in screen space
nearestPointNearestPoint | nullRecord containing the nearest point in both screen and dataspace to the mouse NOTE this prop is only updated if the trackNearestPoint prop is true

Released under the MIT License.