Expand description
§Colorimetry Plot Library
This colormimetry library provides functionality for generating SVG-based color plots,
with both low-level and higher level API, based on top of the Rust-SVG library.
It includes generating basic 2D (x,y) charts composed of several layers, and more complex chromaticity diagrams with
the spectral locus, and gamut fills.
Here is an example of a XY Chromaticity Diagram for the DisplayP3 color space, using the CIE 2015 observer:
Plots are built up in
Layers using coordinate transformations between plot space and world coordinates.
§Modules
chart: Chart composition and rendering.layer: Layered rendering support for compositing multiple plot elements.rendable: Traits and types for objects that can be rendered to SVG.spectrum: Spectrum data visualization and color representation.style_attr: SVG styling attributes and utilities.svgdoc: SVG document creation and manipulation.view: Viewport and plot area management.
§Core Features
- Layered Architecture: Build complex plots by compositing multiple layers
- Coordinate Transforms: Seamless conversion between plot and world coordinate systems
- SVG Generation: High-quality vector graphics output
- Configurable Styling: Flexible styling system for plot elements
- Precision Control: Configurable floating-point precision for clean output
Re-exports§
pub use crate::style_attr::class;pub use crate::style_attr::id;pub use crate::style_attr::style;pub use crate::style_attr::StyleAttr;
Modules§
- chart
- A two-dimensional chart implementation for plotting data in a Cartesian coordinate system.
- layer
- Layer module for SVG rendering
- rendable
- Rendable Trait Module
- style_
attr - Style attributes for SVG elements in the plotting library
- svgdoc
- SVG document representation and rendering.
- view
- View parameters for SVG rendering.
Macros§
- css
- A
StyleAttrstruct with either theclass,style,idor any combination of fields set. This macro allows for flexible creation of style attributes for SVG elements. It supports various combinations ofclass,style, andidattributes, making it easy to define the styling of SVG elements in a concise manner. - delegate_
xy_ chart_ methods - Macro to delegate all XYChart methods to a field of a struct, to avoid using Deref and DerefMut
Add methods here when adding new methods to XYChart
Usage:
delegate_xy_chart_methods!(MyStruct, chart_field);
Functions§
- last_id
- Returns the last generated ID as a string. This can be useful for referencing the last created SVG element without generating a new ID.
- new_id
- Generates a new unique ID for SVG elements. The ID is prefixed with “id” and is incremented each time this function is called. This is useful for ensuring that each SVG element has a unique identifier.
- round_
to_ default_ precision - Rounds a floating-point value to the default precision. For example, round_to_default_precision(1.23456) returns 1.2. /// # Arguments
- round_
to_ precision - Rounds a floating-point value to the specified precision. For example, round_to_precision(1.23456, 100.0) returns 1.23.