treemap-calc

0.0.1 • Public • Published

Treemap Calc

Calculates treemap rectangles for given values

Install

# yarn 
yarn add treemap-calc
# npm 
npm i treemap-calc

Usage

import treemap from 'treemap-calc';
 
const values = [50, 50];
const containerWidth = 100;
const containerHeight = 50;
 
// set `calcPercents` to `true` to get rects in percentage,
// defaults to `false`
const rects = treemap(
  values,
  containerWidth,
  containerHeight /*, calcPercents */
);
 
/**
 * rects is:
 *
 * [
 *  { x: 0, y: 0, width: 50, height: 50 },
 *  { x: 50, y: 0, width: 50, height: 50 }
 * ]
 **/

Readme

Keywords

none

Package Sidebar

Install

npm i treemap-calc

Weekly Downloads

422

Version

0.0.1

License

MIT

Last publish

Collaborators

  • angryobject