mondrian_charts/
lib.rs

1/*!
2# Mondrian Charts
3
4## Representation
5
6A Mondrian chart is represented using the [`MondrianChart<S, P>`] type. This
7type has two generic arguments, `S` and `P`:
8
9* `S` refers to the type of series data from which the chart was generated.
10* `P` refers to the type of data points from which the chart was generated.
11
12Within the chart are shape lists (one for each series of type `S`), which are
13used to contain shapes. [Shapes](Shape) are used to visualize data points,
14although it differs per type of shape whether that shape is used to represent a
15single data point or multiple.
16
17Whenever a chart is rendered to its output format, all the shapes in a given
18shape list are usually rendered in the same color. If you want to render a
19legend along with the chart, a single shape list would correspond to a single
20item in the legend.
21
22X and Y axis of a chart are represented using the [`Axis`] type.
23
24## Generation
25
26To generate Mondrian charts, use the [`generate()`] or
27[`generate_from_timeseries()`] functions.
28
29Currently, this crate only contains generators to create charts from
30[Fiberplane data types](fiberplane_models), although we welcome contributions to
31generate charts from other types.
32
33## Rendering
34
35Use the [`chart_to_image()`] function to render a static image file, such as
36a PNG file. All image formats from the [`image`] crate are supported.
37
38Charts can also be serialized to SVG using the [`chart_to_svg()`] function.
39Currently, all images are first converted to SVG before being rendered to a
40binary format, although this may change in the future.
41
42## Features
43
44This crate offers the following feature flags, all of which are enabled by
45default:
46
47* **`fiberplane`**: Supports generating charts from Fiberplane data type.
48* **`image`**: Supports rendering charts to static images, such as PNGs.
49* **`svg`**: Supports serializing charts to SVG strings.
50
51*/
52
53mod types;
54pub use types::*;
55
56#[cfg(feature = "image")]
57mod chart_to_image;
58#[cfg(feature = "image")]
59pub use chart_to_image::*;
60
61#[cfg(feature = "svg")]
62mod chart_to_svg;
63#[cfg(feature = "svg")]
64pub use chart_to_svg::*;
65
66#[cfg(feature = "fiberplane")]
67mod fiberplane;
68#[cfg(feature = "fiberplane")]
69pub use fiberplane::*;