package matrix

  1. Overview
  2. Docs

Module Matrix_charts.OverlaySource

Interactive overlays drawn on top of the chart.

Overlays mutate the Grid.t directly. They require a Layout.t to convert between data and cell coordinates. All position parameters (~x, ~y) are in data coordinates.

Sourceval crosshair : ?style:Ansi.Style.t -> ?pattern:Charset.line_pattern -> Layout.t -> Grid.t -> x:float -> y:float -> unit

crosshair layout grid ~x ~y draws vertical and horizontal lines through (x, y), spanning the full plot area. style inherits from Theme.t.crosshair. pattern defaults to `Solid.

Sourceval marker : ?style:Ansi.Style.t -> ?glyph:string -> Layout.t -> Grid.t -> x:float -> y:float -> unit

marker layout grid ~x ~y draws a single glyph at (x, y). style inherits from Theme.t.marker. glyph defaults to "●".

Sourcetype tooltip_anchor = [
  1. | `Auto
  2. | `Left
  3. | `Right
  4. | `Top
  5. | `Bottom
]

The type for tooltip placement.

`Auto tries `Right, `Left, `Top, `Bottom in order, choosing the position with the least clipping and no overlap with the anchor point.

Sourcetype tooltip_border = [
  1. | `Theme
  2. | `None
  3. | `Style of Ansi.Style.t
]

The type for tooltip border styles.

  • `Theme: use the theme's tooltip border.
  • `None: no border.
  • `Style s: custom border style.
Sourceval tooltip : ?style:Ansi.Style.t -> ?border:tooltip_border -> ?padding:int -> ?anchor:tooltip_anchor -> Layout.t -> Grid.t -> x:float -> y:float -> string list -> unit

tooltip layout grid ~x ~y lines draws a tooltip box anchored at (x, y) containing lines. The tooltip is clamped to the plot region. Does nothing if (x, y) maps outside the plot.

  • style inherits from Theme.t.tooltip.
  • border defaults to `Theme.
  • padding is interior padding in cells. Defaults to 1. Clamped to >= 0.
  • anchor defaults to `Auto.
Sourcetype h_anchor = [
  1. | `Left
  2. | `Center
  3. | `Right
]

The type for horizontal text alignment.

Sourcetype v_anchor = [
  1. | `Top
  2. | `Middle
  3. | `Bottom
]

The type for vertical text alignment.

Sourceval text : ?style:Ansi.Style.t -> ?anchor:h_anchor -> ?v_anchor:v_anchor -> Layout.t -> Grid.t -> x:float -> y:float -> string -> unit

text layout grid ~x ~y label draws a text label at (x, y). style inherits from Theme.t.labels. anchor defaults to `Left.

Sourcetype arrow_head = [
  1. | `None
  2. | `Arrow
  3. | `Dot
]

The type for arrow head styles.

  • `None: no head.
  • `Arrow: directional arrow.
  • `Dot: circular dot.
Sourceval arrow : ?style:Ansi.Style.t -> ?head:arrow_head -> Layout.t -> Grid.t -> x1:float -> y1:float -> x2:float -> y2:float -> unit

arrow layout grid ~x1 ~y1 ~x2 ~y2 draws a line from (x1, y1) to (x2, y2) with an optional head at the endpoint. style inherits from Theme.t.labels. head defaults to `Arrow.