Skip to main content

chart_html_into

Function chart_html_into 

Source
pub fn chart_html_into<'a>(
    chart: &Chart<'_>,
    bars: impl IntoIterator<Item = Bar<'a>>,
    opts: &Emit,
    out: &mut String,
)
Expand description

A chart as a run of bars, written into a buffer the caller already has.

The bars arrive as an iterator rather than a slice so a caller holding owned bars can map them through without building a second Vec, which is how quasi-webview holds a Vec<screen::Bar> and this wants makeover_layout::Bar.

An empty axis draws its container and no bars. A chart over nothing is sayable on purpose – see Chart::is_empty – and drawing the frame says so on screen, where dividing by the axis would put NaN in a length.