1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright (c) 2025, Harbers Bik LLC
//! # 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](https://crates.io/crates/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
pub use crate;
use ;
static COUNTER: AtomicUsize = new;
static PRECISION: i32 = 1; // 1 decimal place
/// 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.
/// # Returns
/// A unique ID string in the format "idN", where N is an incrementing number.
/// Returns the last generated ID as a string.
/// This can be useful for referencing the last created SVG element without generating a new ID.
/// Rounds a floating-point value to the specified precision.
/// For example, round_to_precision(1.23456, 100.0) returns 1.23.
///
/// # Arguments
/// * `value` - The value to round.
/// * `precision` - The precision
///
/// # Returns
/// The rounded value.
/// Rounds a floating-point value to the default precision.
/// For example, round_to_default_precision(1.23456) returns 1.2.
/// /// # Arguments
/// * `value` - The value to round.
///
/// # Returns
/// The rounded value.