package matrix

  1. Overview
  2. Docs

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.

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 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.

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.

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. 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.