package matrix
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/matrix.charts/Matrix_charts/Mark/index.html
Module Matrix_charts.MarkSource
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.
Types
The type for mark identifiers. When set, Hit.t.mark_id carries this value.
The type for marks. Construct with the functions below, then pass to Matrix_charts.add or Matrix_charts.make.
The type for bar chart and rule directions.
`Vertical: bars grow upward; rules are horizontal.`Horizontal: bars grow rightward; rules are vertical.
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.
The type for heatmap cell aggregation.
The type for heatmap rendering modes.
The type for bar rendering granularity.
`Cell: one cell per unit.`Half_block: half-block characters for sub-cell bar heights.
The type for candlestick body styles.
The type for candlestick widths in cells.
The type for area chart baselines. `Zero fills down to y=0; `Value v fills down to y=v.
The type for histogram binning methods.
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.
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.
The type for y-axis selectors. `Y2 requires a secondary y-axis configured via Matrix_charts.with_y2_scale.
Constructors
val line :
?id:id ->
?label:string ->
?style:Ansi.Style.t ->
?resolution:Raster.resolution ->
?pattern:Charset.line_pattern ->
?glyph:string ->
?y_axis:y_axis_selector ->
x:('a -> float) ->
y:('a -> float) ->
'a array ->
tline ~x ~y data is a line mark connecting consecutive data points in array order. NaN y-values are skipped.
resolutiondefaults to`Cell.patterndefaults to`Solid.glyph, when set, draws this glyph at each point instead of connecting lines.y_axisdefaults to`Y1.
See also line_gaps.
val line_gaps :
?id:id ->
?label:string ->
?style:Ansi.Style.t ->
?resolution:Raster.resolution ->
?pattern:Charset.line_pattern ->
?glyph:string ->
?y_axis:y_axis_selector ->
x:('a -> float) ->
y:('a -> float option) ->
'a array ->
tline_gaps ~x ~y data is like line except the line breaks where y returns None and resumes at the next Some value.
val scatter :
?id:id ->
?label:string ->
?style:Ansi.Style.t ->
?glyph:string ->
?mode:scatter_mode ->
?y_axis:y_axis_selector ->
x:('a -> float) ->
y:('a -> float) ->
'a array ->
tscatter ~x ~y data plots individual data points. glyph defaults to the charset's default point. mode defaults to `Cell.
val bar :
?id:id ->
?label:string ->
?style:Ansi.Style.t ->
?direction:direction ->
?mode:bar_mode ->
category:('a -> string) ->
value:('a -> float) ->
'a array ->
tbar ~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.
val stacked_bar :
?id:id ->
?direction:direction ->
?gap:int ->
?size:int ->
?mode:bar_mode ->
stacked_bar array ->
tstacked_bar data is stacked bars from pre-segmented data. Segments stack from the baseline upward (or leftward for horizontal).
directiondefaults to`Vertical.gapis inter-bar spacing in cells. Defaults to1. Clamped to>= 0.sizeis explicit bar width in cells.Noneauto-sizes.modedefaults to`Half_block.
val rule :
?id:id ->
?style:Ansi.Style.t ->
?direction:direction ->
?pattern:Charset.line_pattern ->
?y_axis:y_axis_selector ->
float ->
trule value is a reference line spanning the full plot area. direction defaults to `Horizontal (line at y=value). pattern defaults to `Solid.
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 ->
theatmap ~x ~y ~value data is a heatmap mapping value to colours. Multiple points in the same cell are combined using agg.
color_scaleis the colour gradient. Empty uses a default gradient.value_rangefixes the(min, max)for colour mapping.Noneinfers from data.auto_value_rangedefaults totrue; computes the range from data whenvalue_rangeis not set.aggdefaults to`Last.modedefaults toCells_fg.
val candles :
?id:id ->
?bullish:Ansi.Style.t ->
?bearish:Ansi.Style.t ->
?width:candle_width ->
?body:candle_body ->
?y_axis:y_axis_selector ->
ohlc array ->
tcandles 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.
val circle :
?id:id ->
?style:Ansi.Style.t ->
?resolution:Raster.resolution ->
?y_axis:y_axis_selector ->
cx:('a -> float) ->
cy:('a -> float) ->
r:('a -> float) ->
'a array ->
tcircle ~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.
val area :
?id:id ->
?label:string ->
?style:Ansi.Style.t ->
?baseline:area_baseline ->
?resolution:Raster.resolution ->
?y_axis:y_axis_selector ->
x:('a -> float) ->
y:('a -> float) ->
'a array ->
tarea ~x ~y data is a filled area chart between the data line and baseline. baseline defaults to `Zero.
val fill_between :
?id:id ->
?label:string ->
?style:Ansi.Style.t ->
?resolution:Raster.resolution ->
?y_axis:y_axis_selector ->
x:('a -> float) ->
y_low:('a -> float) ->
y_high:('a -> float) ->
'a array ->
tfill_between ~x ~y_low ~y_high data fills the region between two y-value curves.
val histogram :
?id:id ->
?label:string ->
?style:Ansi.Style.t ->
?bins:bin_method ->
?normalize:histogram_normalize ->
x:('a -> float) ->
'a array ->
thistogram ~x data is a histogram from continuous data. Binning is computed eagerly at construction time. bins defaults to Bins 10. normalize defaults to `Count.