figgy-model 0.10.0

figgy chart model — option SSoT, interaction contracts, preset policies.
Documentation
  • Coverage
  • 35.16%
    372 out of 1058 items documented1 out of 267 items with examples
  • Size
  • Source code size: 493.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 8.4 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • shim9610/figgy
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • shim9610

figgy-model

Chart settings and data definitions for figgy: Cartesian axes and series, interaction policies, and the bounded radial, categorical and boxplot models. This crate has no GPU or windowing dependency. The optional serde feature adds serialization and deserialization.

Applications using the renderer normally only need figgy-renderer, which re-exports these model types. Use this package directly when working with chart definitions without a renderer. Rust 1.99 is the declared support floor; lower versions have not been validated.

Install

The Cargo package is figgy-model; its Rust import is model. Version 0.10.0 has not yet been published to crates.io. Until publication:

[dependencies]
model = { package = "figgy-model", git = "https://github.com/shim9610/figgy", rev = "0ae96fcb2d6c0ad5bd6167cc32f0e54b231162e0" }

For a local checkout, replace git/rev with path = "../figgy/crates/model". After publication and verification, use model = { package = "figgy-model", version = "0.10.0" }. Add features = ["serde"] only when serialization is needed. No feature is required for creating, editing or validating models.

Create and edit a chart model

This example runs without a GPU. It creates a donut model, changes one value and validates it. A renderer consumes this same model to prepare pixels and hit maps.

use model::{Color, RadialChart, RadialKind, RadialSlice};

let mut chart = RadialChart {
    kind: RadialKind::Donut { inner_radius: 0.55 },
    slices: vec![
        RadialSlice::new("Control", 30.0, Color::from_rgb8(40, 140, 200)),
        RadialSlice::new("Treatment", 50.0, Color::from_rgb8(220, 160, 60)),
    ],
    ..Default::default()
};
chart.slices[1].value = 70.0;
assert!(chart.validate().is_ok());
assert_eq!(chart.slices.iter().map(|slice| slice.value).sum::<f64>(), 100.0);

Find the relevant types

Data Types
Cartesian axes, ticks, legends and styles Config, default::default_config, SeriesConfig
Numeric input columns Column, DataCell
Pie/donut slice values and presentation RadialChart, RadialSlice
Category/series bars CategoricalChart, BarSeries
Supplied statistical summaries BoxPlotChart, BoxPlotSeries
Selection, dragging and area handles Selectable, Draggable, Resizable, DecorationLayout

Bounded charts have explicit validation and small-data limits. They do not require stream sources, and boxplots do not calculate statistics from raw samples. The renderer owns GPU resources, frame caches and its ColumnSource upload adapter; those are not part of this model crate. See the renderer interaction guide for applying model edits to displayed frames.

Serialization and documentation

Serialization represents model state, not a versioned application file format. Validate externally supplied state before rendering. File storage, migrations and the meaning of supplied statistical summaries belong to the consuming application.

docs.rs includes the optional serde implementations. Build the same feature set locally with cargo doc --locked -p figgy-model --features serde --no-deps --open. Documentation and model tests need no GPU or windowing libraries.

Code is licensed under MIT OR Apache-2.0.

Run cargo test --features serde to check the model contracts and optional serialization. These tests require neither a GPU nor other source checkouts.