Skip to content
/ bruc Public

A library for visualization grammar written in Rust

License

Notifications You must be signed in to change notification settings

aleics/bruc

Repository files navigation

bruc

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.

Build

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 web

Then, you can build the bruc-web project:

cd bruc-web/
npm run build

And run the examples:

cd bruc-web/examples/line-chart
npm i
npm start

Demo

To see bruc in action, refer to the bruc-web examples, or directly the bruc-core examples.

Usage

Primitives

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.

Renders

bruc supports at the moment only SVG as a render artifact. This can be extended in the future to other type of renderers

Charts

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:

About

A library for visualization grammar written in Rust

Resources

License

Stars

Watchers

Forks

Languages