Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/werehamster/simple-square-packing
https://github.com/werehamster/simple-square-packing
algorithm d3 javascript
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/werehamster/simple-square-packing
- Owner: wereHamster
- License: mit
- Created: 2016-11-18T15:48:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T10:56:48.000Z (over 1 year ago)
- Last Synced: 2024-04-15T13:59:02.651Z (7 months ago)
- Topics: algorithm, d3, javascript
- Language: TypeScript
- Homepage: https://werehamster.github.io/simple-square-packing/
- Size: 487 KB
- Stars: 16
- Watchers: 4
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Square Packing Algorithm
You can find an interactive example here: https://werehamster.github.io/simple-square-packing
Blog post explaining the algorithm: https://blog.interactivethings.com/simple-square-packing-algorithm-ddd3c2793711
```javascript
import {packSquares} from './index';// The values which you want to show.
const values = [4, 3, 1, 0.2];// The sizes of the squares are relative to this value. You can use it if you
// want to render multiple figures which need to be sized relatively
// to each other.
const maxValue = 7;const result = packSquares(values, maxValue);
```Consult the source file to see which fields are available in the result.