https://github.com/residentmario/threshold-tree
https://github.com/residentmario/threshold-tree
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/residentmario/threshold-tree
- Owner: ResidentMario
- Created: 2017-01-09T02:29:38.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-13T00:35:58.000Z (over 9 years ago)
- Last Synced: 2025-05-22T21:32:21.975Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# threshold-tree
This is a small module which exports a `ThresholdTree` object. A threshold tree as it is refered to here is a type of [tree data structure](https://en.wikipedia.org/wiki/Tree_(data_structure)) which collects children of a parent node which constitute less than some `threshold%` of the total `n` of that node into an `Other` child node and constituent subtree.
Since this bit of code was written for `d3-log-treemap` (forthcoming), a `d3` visual data display project, `ThresholdTree` is an object construct which accepts two parameters: `data`, a data object as outputted by e.g. `d3.csvParse(csvString)`, and `threshold`, the ratio of the parent node's total entries each child node must have to preserve independence.
## Installation
To get this for [Node.JS](https://nodejs.org/en/):
`npm install threshold-tree`
To build a bundle for front-end using [browserify](http://browserify.org/) run e.g.:
`browserify threshold-tree.js -o umd/threshold-tree.js --standalone tree`
The CDN link (via [unpkg](https://unpkg.com/)) is:
`https://unpkg.com/threshold-tree@[VERSION]/umd/threshold-tree`