Skip to main content

cjc_vizor/
lib.rs

1//! Vizor — grammar-of-graphics data visualization library for CJC.
2//!
3//! Vizor is the first CJC library, validating the library architecture.
4//! It provides a declarative, grammar-of-graphics-style API for creating
5//! plots with deterministic rendering to SVG and BMP (and optionally PNG).
6//!
7//! # Architecture
8//!
9//! ```text
10//! PlotSpec → Layout → Scene → SVG / BMP / PNG
11//!            (coord    (flat     (serializer)
12//!             mapping)  primitives)
13//! ```
14//!
15//! # Usage from CJC
16//!
17//! ```cjc
18//! import vizor
19//!
20//! let p = vizor_plot([1.0, 2.0, 3.0], [4.0, 5.0, 6.0])
21//!     .geom_point()
22//!     .title("My Plot")
23//!     .xlab("X").ylab("Y")
24//!
25//! p.save("plot.svg")
26//! ```
27
28pub mod annotation;
29pub mod bmp;
30pub mod color;
31pub mod dispatch;
32pub mod docs;
33pub mod facet;
34pub mod layout;
35pub mod legend;
36pub mod png_export;
37pub mod raster;
38pub mod render;
39pub mod scene;
40pub mod spec;
41pub mod stats;
42pub mod svg;
43pub mod text;
44pub mod theme;
45
46// Re-export key types for convenience.
47pub use annotation::Annotation;
48pub use color::Color;
49pub use render::build_scene;
50pub use scene::Scene;
51pub use spec::PlotSpec;
52pub use svg::render_svg;
53pub use bmp::render_bmp;
54pub use theme::Theme;
55
56use crate::docs::{VIZOR_BUILTIN_NAMES, VIZOR_METHOD_NAMES};
57
58/// CjcLibrary implementation for Vizor.
59pub struct VizorLibrary;
60
61impl cjc_runtime::lib_registry::CjcLibrary for VizorLibrary {
62    fn name(&self) -> &'static str { "vizor" }
63    fn version(&self) -> &'static str { "0.1.0" }
64    fn builtin_names(&self) -> &[&'static str] { VIZOR_BUILTIN_NAMES }
65    fn method_names(&self) -> &[&'static str] { VIZOR_METHOD_NAMES }
66    fn value_type_names(&self) -> &[&'static str] { &["VizorPlot"] }
67}