Skip to main content

CorePlotting::HistogramMapper

CorePlotting::HistogramMapper

Converts HistogramData into renderable primitives. More…

#include <HistogramMapper.hpp>

Public Functions

Name
RenderableRectangleBatch toBars(HistogramData const & data, HistogramStyle const & style ={})
Convert histogram bins to a rectangle batch (bar chart).
RenderablePolyLineBatch toLine(HistogramData const & data, HistogramStyle const & style ={})
Convert histogram bins to a polyline batch (line chart).
RenderableScene buildScene(HistogramData const & data, HistogramDisplayMode mode, HistogramStyle const & style ={})
Build a complete RenderableScene from histogram data.

Detailed Description

class CorePlotting::HistogramMapper;

Converts HistogramData into renderable primitives.

Usage:

HistogramData hist = computeHistogram(...);
HistogramStyle style;
style.fill_color = {0.2f, 0.6f, 1.0f, 0.8f};

// Bar mode:
auto rect_batch = HistogramMapper::toBars(hist, style);
scene.rectangle_batches.push_back(std::move(rect_batch));

// Line mode:
auto line_batch = HistogramMapper::toLine(hist, style);
scene.poly_line_batches.push_back(std::move(line_batch));

Public Functions Documentation

function toBars

static RenderableRectangleBatch toBars(
    HistogramData const & data,
    HistogramStyle const & style ={}
)

Convert histogram bins to a rectangle batch (bar chart).

Parameters:

  • data Histogram bin data
  • style Visual style

Return: Rectangle batch ready for SceneRenderer

Each bin becomes a rectangle with: x = bin left edge (+ gap) y = 0 width = bin_width (- 2*gap) height = bin count

function toLine

static RenderablePolyLineBatch toLine(
    HistogramData const & data,
    HistogramStyle const & style ={}
)

Convert histogram bins to a polyline batch (line chart).

Parameters:

  • data Histogram bin data
  • style Visual style

Return: Polyline batch ready for SceneRenderer

Generates a step-style polyline that traces the histogram outline: For each bin: left-edge → right-edge at the bin height, with vertical segments connecting adjacent bins.

function buildScene

static RenderableScene buildScene(
    HistogramData const & data,
    HistogramDisplayMode mode,
    HistogramStyle const & style ={}
)

Build a complete RenderableScene from histogram data.

Parameters:

  • data Histogram bin data
  • mode Bar or Line display mode
  • style Visual style

Return: Complete scene

Convenience that creates the batch (bar or line), sets up view/projection as identity (caller will override), and returns a ready-to-upload scene.


Updated on 2026-11-13 at 20:25:42 +0000