🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

treemap-calc

Treemap calculator

0.0.1
latest
Version published
Weekly downloads
425
-43.33%
Maintainers
1
Weekly downloads
 
Created

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 }
 * ]
 **/

FAQs

Package last updated on 03 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts