Skip to content

FerroChart 0.4.0

Choose a tag to compare

@0x0077 0x0077 released this 23 Nov 11:21
· 12 commits to main since this release

Image markers, badges and text in any script.

Added

  • Image markers. Markers take a size (4–64 CSS px), an icon (an image
    registered with the chart, clipped to a circle or square), a label (up to
    8 characters inside the shape, such as DB) and a border ring.
    Chart::add_icon/remove_icon; JavaScript registerIcon(name, url | image | bitmap | ImageData | canvas) and unregisterIcon; Python
    Chart.add_icon(array); C ferrochart_add_icon/ferrochart_remove_icon.
  • Folding. A per-series markerStackLimit: crowded bars show the first
    markers and a "+k" badge for the rest. Clicking the badge reports a
    markerOverflow target.
  • Marker hover. A markerHover event (Rust ChartEvent::MarkerHover,
    Python marker_hover, C FERROCHART_EVENT_MARKER_HOVER) with the marker or
    badge under the pointer, its center and size, for tooltips.
  • Text in any script. Characters the bundled font lacks come from fallback
    fonts (WindowOptions::fonts in winit, Chart(fonts=[...]) in Python,
    ferrochart_add_font in C, TextEngine::add_fallback_font in Rust), or on
    the web from the browser's own fonts, including color emoji (feature
    text-browser, on by default; no fonts are added to the package). A
    character no font has is drawn as □.
  • Grapheme clusters. Text is laid out by grapheme cluster: on the web, an
    emoji with a skin tone, a ZWJ sequence (families, professions), a flag or a
    letter with a combining accent is drawn as one glyph. Rust:
    TextEngine::glyphs, and GlyphSource is called with a cluster (&str).
  • C ABI. ferrochart_set_markers with FerroChartMarker;
    FerroChartSeriesOptions.marker_stack_limit.
  • Layer plugins' icon command takes the same image, label, border and
    borderWidth. The lightweight-charts compatibility layer honors marker
    size.

Changed

  • Breaking for Rust struct literals (hence 0.4.0): new fields in Marker,
    SeriesOptions, IconInst, GlyphBitmap (rgba, for color glyphs) and
    WindowOptions (fonts). The JavaScript, Python and C APIs only add.

Fixed

  • A canvas hidden with display: none (CSS size 0) no longer logs "invalid
    render target size" on every change; the chart redraws when it is shown.

Known limitations

  • No shaping or right-to-left layout: Arabic and Hebrew do not come out
    right. Natively (without the browser), emoji sequences are drawn character
    by character.

Packages