package matrix

  1. Overview
  2. Docs

Module Matrix_charts.AxisSource

Axis rendering configuration.

Controls visibility, tick marks, labels, and styling for a single axis.

Sourcetype formatter = int -> float -> string

The type for tick label formatters. Receives the tick index (zero-based) and the tick value. See Label_format.

Sourcetype line = [
  1. | `None
  2. | `Axis_only
  3. | `Frame
]

The type for axis line rendering modes.

  • `None: no axis line.
  • `Axis_only: axis line only.
  • `Frame: full frame around the plot area.
Sourcetype title = {
  1. text : string;
  2. style : Ansi.Style.t option;
}

The type for axis titles.

Sourcetype t = {
  1. show : bool;
    (*

    Whether to render this axis.

    *)
  2. line : line;
    (*

    Axis line mode.

    *)
  3. ticks : int;
    (*

    Target number of ticks. The actual count may differ for "nice" tick spacing.

    *)
  4. format : formatter;
    (*

    Tick label formatter.

    *)
  5. style : Ansi.Style.t option;
    (*

    Axis line style. None inherits from theme.

    *)
  6. tick_style : Ansi.Style.t option;
    (*

    Tick mark style. None inherits from theme.

    *)
  7. label_style : Ansi.Style.t option;
    (*

    Tick label style. None inherits from theme.

    *)
  8. tick_length : int;
    (*

    Tick mark length in cells.

    *)
  9. label_padding : int;
    (*

    Space between tick mark and label in cells.

    *)
  10. title : title option;
    (*

    Axis title.

    *)
}
Sourceval hidden : t

Hidden axis: show = false, no ticks, no line.

Sourceval default : t

Default axis: visible, 6 target ticks, `Axis_only line, 1-cell ticks with 1-cell label padding.

Sourceval with_ticks : int -> t -> t

with_ticks n a is a with target tick count n. Clamped to >= 0.

Sourceval with_format : formatter -> t -> t

with_format fmt a is a with tick label formatter fmt.

Sourceval with_style : Ansi.Style.t -> t -> t

with_style s a is a with axis line style s.

Sourceval with_tick_style : Ansi.Style.t -> t -> t

with_tick_style s a is a with tick mark style s.

Sourceval with_label_style : Ansi.Style.t -> t -> t

with_label_style s a is a with tick label style s.

Sourceval with_tick_length : int -> t -> t

with_tick_length n a is a with tick mark length n. Clamped to >= 0.

Sourceval with_label_padding : int -> t -> t

with_label_padding n a is a with label padding n. Clamped to >= 0.

Sourceval with_line : line -> t -> t

with_line mode a is a with axis line mode mode.

Sourceval with_title : ?style:Ansi.Style.t -> string -> t -> t

with_title text a is a with title text.