23 releases (11 breaking)

0.12.0 Mar 29, 2024
0.11.0 Mar 11, 2024
0.4.0 Dec 4, 2023
0.3.0-beta.1 Nov 30, 2023

#98 in Visualization

Download history 4/week @ 2023-12-29 6/week @ 2024-01-05 2/week @ 2024-01-26 18/week @ 2024-02-02 190/week @ 2024-02-09 28/week @ 2024-02-16 290/week @ 2024-02-23 257/week @ 2024-03-01 367/week @ 2024-03-08 36/week @ 2024-03-15 54/week @ 2024-03-22 182/week @ 2024-03-29 15/week @ 2024-04-05

251 downloads per month

MIT/Apache

215KB
5K SLoC

Mondrian Charts

Crates.io Docs

Abstract chart generator and renderer

Mondrian provides a set of types for abstract charts. An abstract chart defines what a chart should look like, without going into the details of its exact rendering. It allows for generating static images (everything you need for that is in this crate), but can also be used as a source to generate interactive charts using the fiberplane-charts library. The latter also contains a full TypeScript implementation for generating Mondrian charts.

This crate also comes with generators for creating Mondrian charts based on timeseries data defined using fiberplane-models. That said, the dependency on fiberplane-models is optional, so if you want to generate Mondrian charts from your own data types, you can.

Finally, this crate features exporters for generating SVG and PNG images from Mondrian charts, as well as other image formats supported by the image crate.

Why not use SVG?

Just like SVG, Mondrian is a declarative format that relies on a renderer for the final visualization. So why not just use SVG?

  • Mondrian is highly opinionated towards the use case of charts. While it uses abstract "SVG-like" shapes to represent the chart's content, it has chart-specific features such as axes with tick suggestions.
  • Mondrian allows creating interactive charts by attaching metadata that can be used to make the axes draggable as well as to facilitate tooltips when hovering over shapes.

Other notable differences include:

  • Coordinates in Mondrian charts are normalized to values ranging from 0.0 through 1.0. This makes it very easy to render charts at any desired resolution by simply multiplying the coordinates with the desired width and height.
  • Mondrian data types are typically serialized as JSON, although any format supported by serde can be used.

Finally, it bears mentioning that while Mondrian is a useful intermediary format before rendering to a more concrete output, Mondrian charts can indeed be serialized to SVG as well.

Usage

See: https://docs.rs/mondrian-charts/latest/mondrian_charts

Getting Help

Please see COMMUNITY.md for ways to reach out to us.

Contributing

Please follow our Contributing Guidelines to learn how best to contribute to this project.

Code of Conduct

See CODE_OF_CONDUCT.md.

License

This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT.

Dependencies

~15MB
~115K SLoC