Visualization

Chart data models, native HTML/SVG builders, Plotly/Bokeh documents and the optional ImPlot backend.

See the usage guide for task-oriented examples. Signatures below are generated from the public headers at the same commit as the rest of this site.

class bokeh_backend

Native Bokeh-compatible backend.

Mirrors fincore.viz.interactive.bokeh_backend.BokehBackend artifact behaviour over native chart data. show is headless and returns false.

Public Functions

explicit bokeh_backend(std::string theme = "light", int height = 500, int width = 800, std::string sizing_mode = "fixed")

Creates a backend with a theme, size and sizing mode.

The dark theme selects dark fill, grid and text colors; other names use light colors. Throws input_error when height or width is not positive.

inline const std::string &theme() const noexcept

Returns the configured theme name.

inline int height() const noexcept

Returns the configured plot height.

inline int width() const noexcept

Returns the configured plot width.

inline const std::string &sizing_mode() const noexcept

Returns the configured sizing mode.

inline const std::string &background_fill_color() const noexcept

Returns the resolved plot background color.

inline const std::string &grid_line_color() const noexcept

Returns the resolved grid line color.

inline const std::string &text_color() const noexcept

Returns the resolved text color.

bokeh_document create_document(std::string title) const

Creates a base document with the configured size, colors and axes.

bokeh_document plot_returns(const series_chart &chart) const

Builds a cumulative-returns document.

Throws input_error when the chart has no series or a series label and value count differ.

bokeh_document plot_drawdown(const series_chart &chart) const

Builds a drawdown document with area and line glyphs.

Throws input_error when the chart has no series or a series label and value count differ.

bokeh_document plot_rolling_sharpe(const series_chart &chart, std::size_t window = 252) const

Builds a rolling-Sharpe document.

The recorded chart.window wins when non-zero; window is the fallback for charts built without a recorded window. Throws input_error when the chart has no series or lengths differ.

bokeh_document plot_monthly_heatmap(const heat_grid &grid) const

Builds a monthly returns heatmap document.

Throws input_error when there is no year or values are not years x 12.

bool show(const bokeh_document &document) const

Headless: returns false, records NOT_RUN_INTERACTIVE.

void save_html(const bokeh_document &document, const std::string &path) const

Writes document as self-contained HTML to path.

Throws input_error for an empty path or a file that cannot be opened or written.

inline std::string_view last_show_status() const noexcept

Returns the status recorded by the most recent show call.

class html_report_builder

Owning native self-contained HTML performance report builder.

Mirrors fincore.viz.html_backend.HtmlReportBuilder: title/heading/raw HTML sections, stats tables, metric cards, cumulative-returns/drawdown/ rolling-Sharpe tables and the monthly-returns pivot table. All chart values come from precomputed native chart data; the builder never recomputes a financial kernel. build() is deterministic and contains no external stylesheet, script or image reference.

Public Functions

html_report_builder &add_title(std::string title = "Performance Report")

Appends an escaped level-1 title section.

html_report_builder &add_heading(std::string text, int level = 2)

Appends an escaped heading clamped to levels 1 through 6.

html_report_builder &add_stats_table(const std::vector<html_metric> &stats)

Appends a two-column stats table with four-decimal numeric values.

Missing values print nan, matching the Python oracle.

html_report_builder &add_metric_cards(const std::vector<html_metric> &stats)

Appends metric cards using each metric’s key in input order.

html_report_builder &add_metric_cards(const std::vector<html_metric> &stats, const std::vector<std::string> &keys)

Appends metric cards for keys in the requested order.

Missing or non-finite values render as N/A.

html_report_builder &add_html(std::string raw_html)

Appends raw HTML without escaping.

html_report_builder &plot_returns(const chart_series &series)

Appends a cumulative-returns table section.

html_report_builder &plot_drawdown(const chart_series &series)

Appends a drawdown table section.

html_report_builder &plot_rolling_sharpe(const chart_series &sharpe, const chart_series *benchmark = nullptr, std::size_t window = 252)

Appends rolling-Sharpe tables and an optional benchmark table.

html_report_builder &plot_monthly_heatmap(const heat_grid &grid)

Appends the monthly heatmap table in percent.

Throws input_error when grid.values is not years x 12; missing cells print NaN.

std::string build() const

Builds a self-contained deterministic HTML document.

void save(const std::string &path) const

Writes the built document to path.

Throws input_error for an empty path or a file that cannot be opened or written.

inline const std::vector<std::string> &sections() const noexcept

Returns the appended section fragments in order.

Public Static Functions

static std::string_view css()

Stable report CSS (the Python HtmlReportBuilder._CSS block).

class plotly_backend

Native Plotly-compatible backend.

Mirrors fincore.viz.interactive.plotly_backend.PlotlyBackend artifact behaviour. Chart inputs are native chart data, not pandas objects. show is headless and always reports NOT_RUN_INTERACTIVE.

Public Functions

explicit plotly_backend(std::string theme = "light", int height = 500, std::optional<int> width = std::nullopt, std::optional<std::string> template_name = std::nullopt, bool show_legend = true)

Creates a backend with a theme, size, template and legend option.

Themes dark and plotly_dark resolve to dark colors and the plotly_dark default template; other names use light colors and plotly_white. Throws input_error when height or width is not positive.

inline const std::string &theme() const noexcept

Returns the configured theme name.

inline const plotly_color_theme &colors() const noexcept

Returns the resolved theme colors.

inline const std::string &default_template() const noexcept

Returns the theme-derived default template name.

const std::string &effective_template() const noexcept

Returns the explicit template, or the theme default when unset.

inline int height() const noexcept

Returns the configured figure height.

inline const std::optional<int> &width() const noexcept

Returns the configured figure width, if any.

inline bool show_legend() const noexcept

Returns whether the document legend is enabled.

plotly_document create_document(std::string title) const

Base document with the configured template, size and theme colors.

plotly_document plot_returns(const series_chart &chart)

Builds and records a cumulative-returns figure.

Throws input_error when the chart has no series or a series label and value count differ.

plotly_document plot_drawdown(const series_chart &chart)

Builds and records a drawdown figure with filled series.

Throws input_error when the chart has no series or a series label and value count differ.

plotly_document plot_rolling_sharpe(const series_chart &chart, std::size_t window = 252)

Builds and records a rolling-Sharpe figure.

The recorded chart.window wins when non-zero; window is the fallback for charts built without a recorded window. Throws input_error when the chart has no series or lengths differ.

plotly_document plot_monthly_heatmap(const heat_grid &grid)

Builds and records a monthly returns heatmap.

Throws input_error when there is no year or values are not years x 12.

plotly_document plot_correlation_matrix(const correlation_matrix &matrix)

Builds and records a correlation heatmap.

Throws input_error when labels are empty or values are not labels x labels.

plotly_document plot_efficient_frontier(const frontier_chart_data &frontier)

Builds and records an efficient frontier figure.

Throws input_error when volatilities and returns differ in length.

void set_figure(plotly_document document)

Record an externally assembled document as the current figure.

inline bool has_figure() const noexcept

Returns whether a figure has been recorded.

const plotly_document &figure() const

Throws input_error when no plot method ran yet.

void save_html(const std::string &path) const

Writes the recorded figure as self-contained HTML.

Throws input_error when no figure exists or the path cannot be written.

void save_image(const std::string &path) const

Writes the recorded figure as SVG.

Throws input_error when no figure exists or the path cannot be written.

bool show() const

Headless: returns false, records NOT_RUN_INTERACTIVE.

inline std::string_view last_show_status() const noexcept

Returns the status recorded by the most recent show call.

class printf_tick_formatter

Native equivalent of PrintfTickFormatter.

Supports one printf conversion — %[flags][width][.precision] followed by one of f, e, g, d or i — plus %%. Invalid formats raise input_error instead of Python’s ValueError/TypeError.

Public Functions

explicit printf_tick_formatter(std::string format = "%.1f")

Creates a formatter and validates format.

Throws input_error for an embedded NUL, unsupported conversions, incomplete formats, or more than one conversion.

std::string format(double value) const

Formats value with the configured conversion.

inline const std::string &format_string() const noexcept

Returns the configured format string.

class renderer_snapshot

An owning snapshot of explicitly registered native renderer callbacks.

Names are trimmed using ASCII whitespace and lowercased using ASCII rules. An empty/duplicate normalized name or empty callback is rejected. The snapshot does not scan plugins, import optional dependencies, or mutate a process-wide registry. render passes a copied model to the callback for the duration of the call; callbacks that queue work must copy that model before returning. Mutable state captured by callbacks remains the caller’s responsibility. Built-in HTML rendering remains render_html over a report_document.

Public Functions

explicit renderer_snapshot(renderer_map renderers)

Creates an immutable snapshot of the supplied renderer callbacks.

Throws input_error for an empty normalized name, an empty callback, or names that collide after trimming and ASCII lowercasing.

renderer_callback resolve_renderer(std::string_view name) const

Returns the callback registered under name after name normalization.

Throws input_error for an empty or unknown normalized name.

report_document render(std::string_view name, const render_model &model) const

Renders name with a copied model and returns its report document.

Throws input_error for an unknown renderer; exceptions raised by the callback propagate unchanged.

struct bar_chart

Grouped bar chart data in row-major order.

Public Members

std::vector<std::string> group_labels

Group labels on the x axis.

std::vector<std::string> series_labels

Series names in draw order.

std::vector<double> values

Groups x series values in row-major order.

struct bokeh_document

Owning Bokeh-compatible chart document.

Emits a self-contained HTML/JSON document with equivalent data, axes, legends and series. BokehJS model identity is not cloned.

Public Functions

std::string to_json() const

Serializes the document to deterministic Bokeh-compatible JSON.

Throws input_error when a rect glyph’s x, y and value lengths differ, or a glyph’s x and y lengths differ.

std::string to_svg() const

Deterministic SVG rendering of the document (no third-party asset).

std::string to_html() const

Returns self-contained HTML with inline SVG and the JSON payload.

void save_html(const std::string &path) const

Writes to_html() output to path.

Throws input_error for an empty path or a file that cannot be opened or written.

Public Members

std::string title

Document title.

std::string x_axis_type = "datetime"

X-axis type.

std::string x_axis_label

X-axis label.

std::string y_axis_label

Y-axis label.

int height = 500

Plot height.

int width = 800

Plot width.

std::string sizing_mode = "fixed"

Bokeh sizing mode.

std::string background_fill_color = "#FFFFFF"

Plot background.

std::string border_fill_color = "#FFFFFF"

Outer background.

std::string grid_line_color = "#E0E0E0"

Grid line color.

std::string text_color = "#424242"

Text color.

std::string axis_location

Axis location; empty omits it.

std::string toolbar_location

Toolbar location; empty omits it.

bool grid_visible = true

Whether grid lines are visible.

bool axis_visible = true

Whether axes are visible.

std::string major_label_text_font_size

Major tick font size.

int major_label_standoff = 0

Major tick standoff.

int color_bar_desired_ticks = 10

Requested colorbar tick count.

std::vector<bokeh_glyph> glyphs

Glyphs in draw order.

std::vector<bokeh_hover> hovers

Hover tools.

std::vector<bokeh_span> spans

Span annotations.

std::string legend_location

Legend location.

std::string legend_click_policy

Legend click policy.

std::vector<std::string> x_factors

Categorical x factors.

std::vector<std::string> y_factors

Categorical y factors.

std::string color_mapper_palette

Color mapper palette.

bool mapper_range_set = false

Whether the mapper range applies.

double mapper_low = 0.0

Lower mapper bound when set.

double mapper_high = 0.0

Upper mapper bound when set.

bool color_bar = false

Whether a colorbar is emitted.

std::string color_bar_ticker = "BasicTicker"

Colorbar ticker type.

struct bokeh_glyph

One owning Bokeh-compatible glyph renderer.

Values are copied from native chart data; no kernel is recomputed here. NaN chart values are serialized as JSON null (an explicit gap) while the parallel label arrays keep their length.

Public Types

enum class kind

Supported glyph kinds.

Values:

enumerator line

Line glyph.

enumerator varea

Vertical-area glyph.

enumerator rect

Rectangle heatmap glyph.

Public Members

kind type = kind::line

Glyph kind.

std::string x_field

Data field used for x values.

std::string y_field

Data field used for y values.

std::vector<std::string> x_labels

ISO date labels for datetime x axes; takes precedence over x_values.

std::vector<double> x_values

Numeric x values used when x_labels is empty.

std::vector<double> y_values

Y values; NaN entries serialize as JSON null.

std::string color

Line color.

double line_width = 2.0

Line width.

std::string line_dash

Line dash style, such as “solid” or “dashed”.

std::string fill_color

Area fill color.

double fill_alpha = 1.0

Area fill opacity.

std::string legend_label

Legend entry label.

std::vector<std::string> rect_x

Rectangle x category labels.

std::vector<std::string> rect_y

Rectangle y category labels.

std::vector<double> rect_values

Flattened heatmap cell values; NaN entries serialize as JSON null.

std::string palette

Named color palette.

bool mapper_range_set = false

Whether the mapper range applies.

double mapper_low = 0.0

Lower mapper bound when set.

double mapper_high = 0.0

Upper mapper bound when set.

struct bokeh_hover

Hover tool configuration for a Bokeh-compatible document.

Public Members

std::vector<std::pair<std::string, std::string>> tooltips

Tooltip pairs.

std::string mode = "mouse"

Hover mode.

std::map<std::string, std::string> formatters

Field formatter names.

struct bokeh_span

Span annotation drawn across a plot.

Public Members

double location = 0.0

Span position on its axis.

std::string dimension = "width"

Span dimension, width or height.

std::string line_color

Span line color.

double line_alpha = 1.0

Span line opacity.

struct chart_series

One labelled line series in a chart.

Public Members

std::string label

Legend label.

std::vector<timestamp> index

Observation timestamps.

std::vector<double> values

Values aligned with index.

bool benchmark = false

Whether this is a benchmark series.

bool dashed = false

Whether the line is dashed.

struct correlation_matrix

Pairwise Pearson correlation matrix.

Public Members

std::vector<std::string> labels

Asset labels in matrix order.

std::vector<double> values

Labels x labels row-major; NaN when undefined.

std::vector<bool> present

Whether each matrix cell is defined.

std::string unit = "correlation"

Value unit.

struct frontier_chart_data

Chart-ready efficient frontier points and marker coordinates.

Public Members

std::vector<double> volatilities

Frontier volatility points.

std::vector<double> returns

Frontier return points.

std::vector<double> sharpe

Frontier Sharpe points.

double min_variance_volatility = 0.0

Minimum-variance volatility.

double min_variance_return = 0.0

Minimum-variance return.

double max_sharpe_volatility = 0.0

Maximum-Sharpe volatility.

double max_sharpe_return = 0.0

Maximum-Sharpe return.

std::string x_label = "Volatility"

X-axis label.

std::string y_label = "Return"

Y-axis label.

struct heat_grid

Monthly return heatmap data in percent.

Public Members

std::string title = "Monthly returns"

Chart title.

std::vector<int> years

Row year labels.

std::vector<std::string> columns

Month label per column.

std::vector<double> values

Years x 12 row-major; NaN when missing.

std::vector<bool> present

Same shape as values; missing is not zero.

std::string unit = "percent"

Value unit.

double color_min = -10.0

Lower color-scale bound.

double color_max = 10.0

Upper color-scale bound.

bool color_centered = true

Whether the color scale is centered.

struct histogram_bins

Histogram edges, counts and densities.

Public Members

std::vector<double> edges

Ascending bin edges; one more than bins.

std::vector<double> counts

Finite observation count per bin.

std::vector<double> density

Counts / (n_observations * bin width).

std::size_t n_observations = 0U

Number of finite observations.

struct html_metric

One owning key/value entry for the native HTML report builder.

Python’s builder accepts a pd.Series of floats; the native builder uses this explicit entry so a value is either a finite-checked number, text or absent. Missing rendering follows the Python oracle: stats tables print nan, metric cards print N/A.

Public Members

std::string key

Metric display key.

std::optional<double> number

Numeric value when present.

std::optional<std::string> text

Text value when no number is present.

Public Static Functions

static html_metric number_metric(std::string key, double value)

Creates a metric with a numeric value.

static html_metric text_metric(std::string key, std::string value)

Creates a metric with a text value.

static html_metric missing(std::string key)

Creates a metric with no value.

struct plotly_annotation

Text annotation in layout coordinates.

Public Members

std::string text

Annotation text.

double x = 0.0

X position.

double y = 0.0

Y position.

std::string xref = "paper"

X reference coordinate system.

std::string yref = "paper"

Y reference coordinate system.

bool show_arrow = false

Whether to draw an arrow.

struct plotly_axis

Axis configuration for a Plotly-compatible document.

Public Members

std::string title

Axis title.

std::string side

Axis side, such as bottom.

bool reversed = false

Whether the axis range is reversed.

std::string tickmode

Tick mode, such as array.

std::vector<double> tick_values

Explicit tick positions.

std::vector<std::string> tick_text

Explicit tick labels.

struct plotly_color_theme

Theme colors used by the native Plotly-compatible document.

Public Members

std::string background

Plot and paper background color.

std::string grid

Grid and zero-line color.

std::string text

Title, axis and tick text color.

std::string positive

Color for positive markers.

std::string negative

Color for negative series.

std::string neutral

Color for benchmark or neutral series.

std::string highlight

Primary series highlight color.

std::string warning

Secondary marker color.

bool dark = false

Whether the theme uses dark backgrounds.

struct plotly_document

Owning native Plotly-compatible chart document.

to_json() is deterministic (fixed key order, Python-style float text) and covers the emitted subset of the Plotly schema: data traces with scatter/heatmap fields and a layout with title, axes, legend, shapes and annotations. Plotly.js object identity is not claimed.

Public Functions

std::string to_json() const

Serializes the document to deterministic Plotly-compatible JSON.

Throws input_error when a heatmap trace has an invalid heatmap_z/heatmap_columns size or its labels do not match the matrix.

std::string to_svg() const

Deterministic SVG rendering of the document (no third-party asset).

std::string to_html() const

Self-contained HTML: inline SVG plus the deterministic JSON payload.

void save_html(const std::string &path) const

Writes to_html() output to path.

Throws input_error for an empty path or a file that cannot be opened or written.

void save_image(const std::string &path) const

Writes SVG; declared format variance from Plotly’s PNG export.

Public Members

std::string title

Document title.

std::string template_name

Plotly template name; empty omits it.

std::optional<int> height = 500

Layout height; nullopt omits it.

std::optional<int> width

Layout width; nullopt omits it.

bool show_legend = true

Whether the legend is shown.

std::string hovermode

Hover mode; empty omits it.

std::string font_color

Font color; empty omits the font block.

std::string plot_background

Plot background color.

std::string paper_background

Paper background color.

std::string grid_color

Grid and zero-line color.

plotly_axis x_axis

X-axis configuration.

plotly_axis y_axis

Y-axis configuration.

std::vector<plotly_trace> traces

Traces in draw order.

std::vector<plotly_shape> shapes

Layout shapes.

std::vector<plotly_annotation> annotations

Layout annotations.

struct plotly_shape

Horizontal or line shape added to the layout.

Public Members

std::string type = "line"

Shape type.

double y0 = 0.0

First y coordinate.

double y1 = 0.0

Second y coordinate.

std::string yref = "y"

Y reference axis.

std::string xref = "paper"

X reference coordinate system.

double x0 = 0.0

First x coordinate.

double x1 = 1.0

Second x coordinate.

std::string line_color

Shape line color.

double line_width = 1.0

Shape line width.

std::string line_dash

Shape line dash style.

struct plotly_trace

One owning Plotly-compatible trace.

Values are copied from native chart data (series_chart, heat_grid, correlation_matrix, frontier_chart_data); rendering never recomputes a financial kernel. NaN entries are serialized as JSON null so missingness is explicit.

Public Types

enum class kind

Supported trace kinds.

Values:

enumerator scatter

Scatter or line trace.

enumerator heatmap

Heatmap trace.

Public Members

kind type = kind::scatter

Trace kind.

std::string name

Trace name used by the legend.

std::string mode

Plotly mode, such as lines or markers.

std::string line_color

Line color; empty omits the color.

double line_width = 0.0

Line width; zero omits the line block.

std::string line_dash

Line dash style.

std::string fill

Fill mode, such as tozeroy.

std::string fill_color

Fill color.

double marker_size = 0.0

Marker size; zero disables markers.

std::string marker_color

Marker color.

std::string marker_symbol

Marker symbol, such as star.

std::string hovertemplate

Hover template string.

std::vector<std::string> x_labels

Date or category labels; takes precedence over x_values.

std::vector<double> x_values

Numeric x values used when x_labels is empty.

std::vector<double> y_values

Y values; NaN entries serialize as JSON null.

std::vector<double> custom_data

Per-point custom data; NaN entries serialize as JSON null.

std::vector<std::string> heatmap_x

Heatmap column labels.

std::vector<std::string> heatmap_y

Heatmap row labels.

std::vector<double> heatmap_z

Heatmap values in row-major order; NaN entries serialize as JSON null.

std::size_t heatmap_columns = 0U

Number of columns in heatmap_z.

std::string colorscale

Named color scale.

std::vector<std::pair<double, std::string>> color_stops

Custom color scale stops as value/color pairs.

bool color_range_set = false

Whether the explicit color range applies.

double color_min = 0.0

Lower color bound when set.

double color_max = 0.0

Upper color bound when set.

bool zmid_zero = false

Whether the color scale is centered at zero.

std::string colorbar_title

Colorbar title; empty omits it.

std::string colorbar_tickformat

Colorbar tick format.

struct render_model

Structured, owning inputs passed to a native visualization renderer.

This maps the pinned Python RenderModel fields in fincore/viz/base.py (4b8f31b1b59707480d5db9603704d83bbf7e6946): returns, optional factor_returns, and period. C++ uses the native frequency enum instead of the Python string convention.

Public Functions

explicit render_model(dataframe returns, std::optional<dataframe> factor_returns = std::nullopt, frequency period = frequency::daily)

Creates an owning render model from the supplied frames and period.

Public Members

dataframe returns

Portfolio return frame.

std::optional<dataframe> factor_returns

Optional factor return frame.

frequency period = frequency::daily

Return frequency.

struct series_chart

Owning multi-series line chart data.

Public Members

std::string title

Chart title.

std::string y_label

Y-axis label.

std::vector<chart_series> series

Series in draw order.

bool zero_line = false

Whether to draw a zero line.

bool fill_to_zero = false

Whether to fill down to zero.

std::size_t window = 0U

Recorded rolling window, or 0.

struct series_chart_spec

Description of one series to copy from a frame.

Public Members

std::string column

Source double column name.

std::string label

Legend label.

bool benchmark = false

Whether the series is a benchmark.

bar_chart fincore::build_bar_chart(std::vector<std::string> group_labels, std::vector<std::string> series_labels, std::vector<double> values)

Builds grouped bar data from labels and row-major values.

Throws input_error when either label list is empty, a label is empty, values does not contain groups x series entries, or a value is non-finite.

correlation_matrix fincore::build_correlation_matrix(const dataframe &frame)

Builds a pairwise correlation matrix from double columns.

Pairs with fewer than two finite observations or zero variance remain NaN with present == false. Throws input_error when no double column exists or a column name is empty.

series_chart fincore::build_drawdown_chart(const dataframe &frame, std::string_view column = "drawdown", std::string_view label = "Drawdown")

Builds a drawdown chart with fill-to-zero enabled.

Throws input_error when the column is missing or invalid.

frontier_chart_data fincore::build_frontier_chart(const efficient_frontier_result &frontier)

Builds chart data from an efficient frontier result.

Throws input_error when point vectors differ in length or any value or marker coordinate is non-finite.

histogram_bins fincore::build_histogram(std::span<const double> values, std::size_t bins = 10U)

Builds histogram bins from finite observations.

Non-finite values are ignored. When all finite values are equal, the range is widened by 0.5 on each side. Throws input_error when bins is zero or no finite observation exists.

heat_grid fincore::build_monthly_heatmap(const dataframe &returns, std::string_view column = returns_column)

Builds a monthly percent heatmap from a return column.

The frame index must be sorted ascending and column must name a double column. Months without a finite compounded value remain NaN with present == false; the color range covers observed values or defaults to -10..10 when no value exists. Throws input_error for invalid input.

series_chart fincore::build_returns_chart(const dataframe &frame, std::string_view column = "cumulative_returns", std::string_view label = "Cumulative Returns")

Builds the cumulative-return chart from a frame column.

The chart includes a zero line and uses “Cumulative Returns” and “Cumulative Return” as title and axis label. Throws input_error when the column is missing or invalid.

series_chart fincore::build_rolling_sharpe_chart(const dataframe &portfolio, std::string_view column, std::size_t window, const dataframe *benchmark = nullptr, std::string_view benchmark_column = "benchmark_sharpe", std::string_view label = "Portfolio Sharpe", std::string_view benchmark_label = "Benchmark Sharpe")

Builds a rolling-Sharpe chart and records the window.

When benchmark is non-null, a dashed benchmark series is read from benchmark_column. Throws input_error for a missing or invalid column, an empty portfolio label, or an empty benchmark label when a benchmark is supplied.

series_chart fincore::build_series_chart(const dataframe &frame, const std::vector<series_chart_spec> &specs, std::string title, std::string y_label, bool zero_line = false, bool fill_to_zero = false)

Builds a line chart from named frame columns.

Each series copies the frame index and the requested double column. A benchmark series is marked benchmark and dashed. Throws input_error when specs is empty, a label is empty, or a column is missing or invalid.

void fincore::plot_bar_chart(const bar_chart &chart)

Plots grouped bars from bar chart data.

void fincore::plot_correlation_matrix(const correlation_matrix &matrix)

Plots a correlation heatmap with labelled axes.

void fincore::plot_cumulative_returns(const dataframe &frame, std::string_view column)

Plots a cumulative-returns column with a date axis.

void fincore::plot_drawdown(const dataframe &frame, std::string_view column)

Plots a drawdown column with a date axis.

void fincore::plot_drawdown_chart(const series_chart &chart)

Plots drawdown series as shaded areas with overlaid lines.

void fincore::plot_events_distribution_chart(const events_distribution_chart &chart)

Plots event counts as bars over time buckets.

void fincore::plot_frontier_chart(const frontier_chart_data &chart)

Plots the efficient frontier curve and its marker points.

void fincore::plot_histogram(const histogram_bins &bins)

Plots histogram counts over bin centers.

void fincore::plot_monthly_heatmap(const heat_grid &grid)

Plots a monthly heatmap grid; empty grids are ignored.

void fincore::plot_monthly_ic_heatmap(const monthly_ic_heatmap_chart &chart)

Plots a monthly IC heatmap with a fixed -0.2 to 0.2 color range.

void fincore::plot_qq_chart(const qq_chart &chart)

Plots observed versus theoretical quantiles with a reference line.

void fincore::plot_quantile_cumulative_chart(const quantile_cumulative_chart &chart)

Plots cumulative quantile series by date.

void fincore::plot_rolling_metric(const dataframe &frame, std::string_view column, std::string_view label)

Plots a rolling metric column using label as title and legend.

void fincore::plot_series_chart(const series_chart &chart)

Plots every series of a line chart, including an optional zero line.

void fincore::plot_spread_time_series(const spread_time_series_chart &chart)

Plots spread, rolling mean, band and zero line.

void fincore::plot_violin_chart(const violin_chart &chart)

Plots quantile density shapes and medians per group.

using fincore::renderer_callback = std::function<report_document(const render_model &model)>

Callback that converts a render model into a report document.

using fincore::renderer_map = std::map<std::string, renderer_callback>

Renderer callbacks keyed by caller-provided name.

constexpr std::string_view fincore::NOT_RUN_INTERACTIVE = "NOT_RUN_INTERACTIVE"

Headless interactive status recorded by native show entry points.

Native builds never open a browser or a GUI window. show returns false and this constant is the documented status a caller may record instead of claiming an interactive display.

constexpr std::string_view fincore::month_labels[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}

English month labels used by monthly heatmap columns.