Module Matrix_charts.Mark Source Chart marks (visual encodings of data).
Marks are the graphical primitives rendered on a chart: lines, scatter points, bars, heatmaps, etc. Each constructor extracts data eagerly via accessor functions (~x, ~y, etc.), so the source data can be garbage collected after mark creation.
Marks without an explicit ~style are auto-coloured from the theme palette in the order they are added to the chart.
TypesThe type for mark identifiers. When set, Hit.t.mark_id carries this value.
Source type direction = [ | `Vertical | `Horizontal ] The type for bar chart and rule directions.
`Vertical: bars grow upward; rules are horizontal.`Horizontal: bars grow rightward; rules are vertical.Source type scatter_mode = [ | `Cell | `Braille | `Density ] The type for scatter point rendering modes.
`Cell: one glyph per point.`Braille: sub-cell resolution using Braille patterns.`Density: heatmap-style density shading for overlapping points.Source type heatmap_agg = [ | `Last | `Avg | `Max ] The type for heatmap cell aggregation.
Source type heatmap_mode = | Cells_fg Foreground colour per cell.
| Cells_bg Background colour per cell.
| Halfblock_fg_bg Half-block characters for 2× vertical resolution.
| Shaded | Dense_bilinear Bilinear interpolation for smooth gradients.
The type for heatmap rendering modes.
Source type bar_mode = [ | `Cell | `Half_block ] The type for bar rendering granularity.
`Cell: one cell per unit.`Half_block: half-block characters for sub-cell bar heights.Source type candle_body = [ | `Filled | `Hollow ] The type for candlestick body styles.
Source type candle_width = [ | `One | `Two ] The type for candlestick widths in cells.
Source type area_baseline = [ | `Zero | `Value of float ] The type for area chart baselines. `Zero fills down to y=0; `Value v fills down to y=v.
Source type bin_method = | Bins of int| Width of float| Edges of float array Explicit bin edges. At least 2 elements.
The type for histogram binning methods.
Source type histogram_normalize = [ | `Count | `Density | `Probability ] The type for histogram normalisation.
`Count: raw frequency counts.`Density: normalised so the integral equals 1.`Probability: fraction of total observations per bin.The type for stacked bar segments.
The type for stacked bar entries.
Source type ohlc = { time : float; X-axis position (typically a timestamp).
open_ : float; high : float; low : float; close : float; } The type for open-high-low-close data.
Source type y_axis_selector = [ | `Y1 | `Y2 ] Constructorsline ~x ~y data is a line mark connecting consecutive data points in array order. NaN y-values are skipped.
resolution defaults to `Cell.pattern defaults to `Solid.glyph, when set, draws this glyph at each point instead of connecting lines.y_axis defaults to `Y1.See also line_gaps .
line_gaps ~x ~y data is like line except the line breaks where y returns None and resumes at the next Some value.
scatter ~x ~y data plots individual data points. glyph defaults to the charset's default point. mode defaults to `Cell.
bar ~category ~value data is a bar chart. Categories are placed on the band-scale axis; values determine bar length. Implicitly uses a Scale.t.Band on the category axis and includes zero in the value domain. direction defaults to `Vertical. mode defaults to `Half_block.
stacked_bar data is stacked bars from pre-segmented data. Segments stack from the baseline upward (or leftward for horizontal).
direction defaults to `Vertical.gap is inter-bar spacing in cells. Defaults to 1. Clamped to >= 0.size is explicit bar width in cells. None auto-sizes.mode defaults to `Half_block.rule value is a reference line spanning the full plot area. direction defaults to `Horizontal (line at y=value). pattern defaults to `Solid.
Source val heatmap :
?id :id ->
?color_scale :Ansi.Color.t array ->
?value_range :(float * float) ->
?auto_value_range :bool ->
?agg :heatmap_agg ->
?mode :heatmap_mode ->
x :('a -> float) ->
y :('a -> float) ->
value :('a -> float) ->
'a array ->
t heatmap ~x ~y ~value data is a heatmap mapping value to colours. Multiple points in the same cell are combined using agg.
color_scale is the colour gradient. Empty uses a default gradient.value_range fixes the (min, max) for colour mapping. None infers from data.auto_value_range defaults to true; computes the range from data when value_range is not set.agg defaults to `Last.mode defaults to Cells_fg.candles data is a candlestick chart from OHLC data, sorted by ohlc.time internally. bullish (close >= open) defaults to green; bearish (close < open) defaults to red. width defaults to `One. body defaults to `Filled.
circle ~cx ~cy ~r data draws circles. Radius r is in data units.
shade ~min ~max () is a vertical shaded region between x=min and x=max. If min > max the values are swapped.
column_bg x is a full-height background highlight at data x-coordinate x.
area ~x ~y data is a filled area chart between the data line and baseline. baseline defaults to `Zero.
fill_between ~x ~y_low ~y_high data fills the region between two y-value curves.
histogram ~x data is a histogram from continuous data. Binning is computed eagerly at construction time. bins defaults to Bins 10. normalize defaults to `Count.