Skip to content

jolars/eunoia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

551 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eunoia

Build and Test Crates.io npm version CRAN Badge PyPI version codecov

A Rust library for Euler and Venn Diagrams. This is a rewrite of the eulerr R package, designed to be more flexible, faster, and support multiple language bindings.

Narrative documentation lives at eunoia.bz/docs/; the rustdoc reference is at docs.rs/eunoia.

JavaScript / TypeScript

WebAssembly bindings are published as @jolars/eunoia:

npm install @jolars/eunoia
import { euler, venn } from "@jolars/eunoia";

// Fit an Euler diagram from set sizes
const layout = euler({
  sets: { A: 5, B: 2, "A&B": 1 },
  shape: "circle",        // "circle" | "ellipse" | "square"
  output: "shapes",       // "shapes" | "polygons" | "regions"
  inputType: "exclusive", // "exclusive" | "inclusive"
  seed: 42,
});

if (layout.mode === "shapes" && layout.shape === "circle") {
  for (const c of layout.circles) {
    console.log(c.label, c.x, c.y, c.radius);
  }
}
console.log(layout.metrics.loss, layout.metrics.fittedAreas);

// Or build a canonical n-set Venn diagram
const v = venn({ n: 3, output: "regions" });

The package is built with wasm-pack --target bundler, so it works with any modern bundler (Vite, Webpack, Rollup, esbuild) and Node 20+.

About

A Rust library for Euler and Venn Diagrams

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Contributors