package matrix

Build not yet checked
  1. Overview
  2. Docs
Fast, modern terminal toolkit for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.3.0.tbz
sha256=a92cbbcbe016fb19fb0a749222da0e459a9567aef3f4c7340d9bd6b71c53ed6f
sha512=6a7ab054605538bb31a2b73a1a6d093981a2704c9f0af5852221c05735290d74aca7c7282298c4d0f91e86a800e2ccd94b4918af883cd963449c758eb6b272b3

doc/matrix.charts/Matrix_charts/Layout/index.html

Module Matrix_charts.LayoutSource

Sourcetype t

The type for figures laid out in a region.

Sourcetype value =
  1. | Num of float
  2. | Cat of string
    (*

    The type for scale values.

    *)

plot l is l's plot. The marks place it only through the scales they read, what they imply of them, the domains fitted to their rows and the entries their categories give the legends. So when each position scale has a domain given with scale, and the legends keep their entries, a figure has the same plot at one size under one view whatever its marks' rows: a program can lay the figure out without its rows to learn the plot, and with dot where each value will be drawn. The guides take room, an axis's labels included, so that figure keeps them.

Sourceval value : t -> string -> (int * int) -> value option

value l n c is the value of scale n at the middle of cell c, or the category whose band holds it, and None if c is outside the plot.

Raises Invalid_argument if n is not a position scale of l.

Sourceval position : t -> string -> value -> int

position l n v is the column, or for a y scale the row of cells, of v on scale n, clamped to the plot, and for a category its band's middle.

Raises Invalid_argument if n is not a position scale of l, or v is not one of its values.

Sourceval dot : t -> string -> dots -> value -> int

dot l n r v is the dot of resolution r that holds v on scale n, where a mark of that resolution draws it: its column of dots, or for a y scale its row, counted from 0 at the plot's left, or top, and clamped to [-1;k L], with k the dots of a cell along the axis and L the plot's length in cells: -1 before the plot's first dot and k L past its last. For v in the plot, d / k is position l n v less the plot's origin. A category's dot is its band's middle. Under a theme without Theme.glyphs.blocks, marks draw whole cells and dot still counts the dots of r.

dot l n r looks the scale up once, for a program that maps many values.

Raises Invalid_argument if n is not a position scale of l, v is not one of its values, or v is a value that marks drop.

Sourceval domain : t -> string -> value list

domain l n is the shown domain [Num lo; Num hi] of scale n, or its categories.

Raises Invalid_argument if n is not a position scale of l.

Sourceval zoom : ?axes:[ `X | `Y | `Both ] -> t -> at:(int * int) -> float -> View.t

zoom l ~at k is l's view with the shown domain of each continuous position scale on axes, `Both by default, k times narrower about its value at cell at, or at the plot's nearest cell if at is outside it. A layout of the new view whose plot has the same place shows that value at at. A window that would pass the floats' range is left unchanged.

Raises Invalid_argument if k is not finite and positive.

Sourceval pan : t -> by:(int * int) -> View.t

pan l ~by:(dx, dy) is l's view in which the data drawn at cell (x, y) is drawn at (x + dx, y + dy). For a drag, by is the pointer's move in cells since the previous event. A window that would pass the floats' range is left unchanged.

Sourceval hit : ?radius:float -> ?metric:[ `Euclidean | `X | `Y ] -> t -> (int * int) -> hit option

hit l c is the row whose mark inked cell c last. A cell whose dots several rows inked gives the last of them. When no mark inked c, it is the row that inked last the nearest cell within radius, 3. by default, the later mark's of two at one distance, and None if there is none or c is outside the plot. Distances are in columns. `Euclidean, the default, counts a row of cells as Theme.t.aspect columns. `X keeps the cells within radius columns and adds a hundredth of the vertical distance, which breaks ties, and `Y the converse. It inks the marks again, so it costs about a draw.

Sourceval legend : t -> (string * Ansi.Color.t * string) list

legend l is the category, color and glyph of every legend entry of l, for a program that draws a legend itself.