bruc is a visualization library written in Rust 🦀
bruc is heavily inspired by Vega, a visualization grammar, which allows to create
visualization designs in a declarative way. This follows the principles presented by Leland Wilkinson in his book
The Grammar of Graphics.
At the time being, this project is a mere proof of concept to demonstrate, how such a library could be implemented using Web Assembly. And thus, be used in different environments with a native feel.
To build the project for wasm, you can do that by running wasm-pack under the bruc-wasm project:
cd bruc-wasm/
wasm-pack build --target webThen, you can build the bruc-web project:
cd bruc-web/
npm run buildAnd run the examples:
cd bruc-web/examples/line-chart
npm i
npm startTo see bruc in action, refer to the bruc-web examples,
or directly the bruc-core examples.
bruc makes use of a well-defined specification to declare and design the different parts of the visualization and
how those elements, named also primitives, should interact together. There's three main elements:
data: defines the different input data sources its respective values.visual: defines what visual elements exist in the visualization. This is mainly divided by axes and any kind of shape (e.g. lines or bars).scale: defines how to map the input data values into the coordinates of the canvas that the visual elements are placed.
bruc supports at the moment only SVG as a render artifact. This can be extended in the future to other type of
renderers
bruc currently supports only simple visualization possibilities. As more primitives are added into the library, more
type of charts will be possible. Currently the following are supported and examples demonstrated possible usage: