package matrix
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/matrix.charts/Matrix_charts/Layout/index.html
Module Matrix_charts.LayoutSource
Compiled chart layout for coordinate mapping, hit-testing, and interaction.
A layout is produced by Matrix_charts.draw or Layout and captures the computed coordinate mapping, plot region, and resolved scales. It bridges cell coordinates (from mouse/cursor input) and data coordinates (for tooltips, crosshairs, and snapping).
The type for compiled layouts.
The type for axis-aligned rectangles in cell coordinates.
Geometry
plot_rect l is the data plotting region, excluding axes, labels, and margins.
is_inside_plot l ~px ~py is true iff (px, py) falls within the plot region.
Domain and view
x_domain l is the full x-axis data domain.
y_domain l is the full y-axis data domain.
y2_domain l is the secondary y-axis domain, or None if no secondary axis is configured.
x_view l is the currently visible x-axis range (may be a subset of the domain when zoomed).
y_view l is the currently visible y-axis range.
y2_view l is the currently visible secondary y-axis range.
y_axis_title_width l is the width reserved for the y-axis title, in cells.
y2_axis_width l is the width reserved for the secondary y-axis, in cells.
Coordinate conversion
data_of_px l ~px ~py converts cell coordinates to data coordinates. None if (px, py) is outside the plot region.
px_of_data l ~x ~y converts data coordinates to cell coordinates. Values outside the visible range are clamped to the plot boundary.
Category lookup
x_category_of_px l ~px is the category at cell column px when the x-axis uses a band scale. None for non-band scales or out-of-range positions.
y_category_of_px l ~py is the category at cell row py when the y-axis uses a band scale.
px_of_x_category l cat is the centre cell column for category cat. None if cat is not in the scale.
py_of_y_category l cat is the centre cell row for category cat.
View manipulation
The type for axis selectors in zoom/pan operations.
clamp_view l view constrains view to the layout's data domain. Respects the clamp setting on each scale; band scales are unchanged.
val zoom_view_around_px :
t ->
view:View.t ->
axis:axis ->
px:int ->
py:int ->
factor:float ->
View.tzoom_view_around_px l ~view ~axis ~px ~py ~factor zooms view around the data point at cell position (px, py). If the position is outside the plot, zooms around the centre.
pan_view_by_px l ~view ~dx ~dy pans view by (dx, dy) cells. The delta is converted to data units proportional to the current view range and plot size.
plot_center_px l is the cell coordinates of the plot centre.
zoom_view_around_center l ~view ~axis ~factor zooms view around the plot centre.
See also zoom_view_around_px.
Hit testing
hit_test l ~px ~py is the nearest data point to cell position (px, py), or None if (px, py) is outside the plot region or no point is within radius. radius defaults to 3. policy defaults to `Nearest_px.