Documentation menu

Rust API

The API documentation is generated by rustdoc. Locally:

bash
cargo doc --workspace --exclude ferrochart-py --no-deps --open

Published on docs.rs:

CrateContents
ferrochart-coreChart, data model, scales, input, Frame, Renderer trait, transform_helpers
ferrochart-render-wgpuGpuContext, WgpuRenderer (surface or offscreen)
ferrochart-render-cpuCpuRenderer (tiny-skia)
ferrochart-textTextEngine, the bundled font
ferrochart-winitrun, ChartApp, InputConverter
ferrochart-indicatorsIncremental indicators
ferrochart-orderflowFootprint, heatmap and TPO series (Order flow)

Extending the chart (layers, custom series, native GPU series, transforms, drawing tools) is described in Plugins.

Where to start

  • ferrochart_core::Chart: create it with ChartOptions, resize, add series, set data, feed InputEvents with handle_input, build_frame, read events with drain_events.
  • ferrochart_core::render::Renderer: implemented by both renderers; you call render(chart.frame(), &chart.data_view()).

Rules the API follows

  • No panics. Methods that can fail return Result; lookups by id return Result or Option.
  • No allocations on the hot path. Panning, zooming, moving the crosshair (build_frame) and update_last allocate nothing once warmed up; tests assert this with a counting allocator.
  • Typed coordinates. Css and Px (and the point, size and rect types built on them) keep CSS and device pixels apart; the device pixel ratio is passed to Chart::resize.
  • Core is pure. ferrochart-core has no dependencies outside the standard library (smallvec is the only one allowed): no GPU, window, font, time or async libraries, and no unsafe.