package matrix
Module Matrix_charts.HitSource
Hit-testing results for interactive charts.
Use Layout.hit_test to find the nearest data point or bar to a given cell coordinate, then inspect the returned t for data-level information.
The type for distance metrics.
`Nearest_px: Euclidean distance in cell space.`Nearest_x: horizontal distance only.`Nearest_y: vertical distance only.
The type of mark that was hit.
Source
type payload = Mark-specific data payload.
Source
type t = {mark_id : string option;kind : kind;(*Type of mark that was hit.
*)index : int;(*Index of the data point within the mark's data array.
*)px : int;(*Cell x-coordinate of the snapped hit.
*)py : int;(*Cell y-coordinate of the snapped hit.
*)distance_px : float;(*Distance from query to hit in cell units.
*)0.0for hits inside bars.payload : payload;(*Data values at the hit point.
*)
}The type for hit-test results.