-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: init docs * chore: stat * chore: switch github highlight * chore: stat * feat: add reload * feat: docs anchor * feat: done
- Loading branch information
Showing
16 changed files
with
1,110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
with: | ||
node-version: 22.9.0 | ||
- name: Build site | ||
run: make build-server | ||
run: make build-docs | ||
|
||
- name: Deploy site | ||
uses: JamesIves/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
title: Api | ||
body: | ||
- h1: Api | ||
- p: All the methods and options of the squarified library are documented here. | ||
|
||
- h2: Draw Layout Api | ||
|
||
- p: | | ||
The draw layout API is the main API for the treemap. It provides methods to draw the treemap layout. | ||
Now, the draw layout is opinionated and provides a minimalistic API to draw the treemap layout. | ||
- h3: createTreemap | ||
|
||
- p: > | ||
Create a new instance of the treemap. This method returns a new instance of the treemap. | ||
- pre.js: | | ||
import { createTreemap } from 'squarified' | ||
const treemap = createTreemap() | ||
- h2: Data Transform Api | ||
|
||
- p: | | ||
The data transform API provides methods to transform the data into a format that the treemap can understand. | ||
- h3: c2m | ||
|
||
- p: > | ||
Convert the original data into a format data that the treemap can understand. This method returns a new data format. | ||
- pre.js: | | ||
import { c2m } from 'squarified' | ||
const data = [{ name: 'root', value: 100 }, { name: 'root2', value: 50}, { name: 'root3', value: 150 }] | ||
const transformedData = c2m(data, 'value' , (d) => ({ ...d, label: d.name })) | ||
- h3: findRelativeNode | ||
|
||
- p: > | ||
Find the relative node of the given node. This method returns the relative node of the given node. | ||
Note: This function is based on the `visit` and respect the calculated coordinates. | ||
- h3: findRelativeNodeById | ||
|
||
- p: > | ||
Find the relative node of the given node by id. This method returns the relative node of the given node by id. | ||
Note: This function is based on the `visit`. | ||
- h3: flattenModule | ||
|
||
- p: > | ||
Flatten the module. This method returns the flattened module. | ||
- h3: getNodeDepth | ||
|
||
- p: > | ||
Get the depth of the node. This method returns the depth of the node. | ||
- h3: sortChildrenByKey | ||
|
||
- p: > | ||
Sort the children by key. This method returns the sorted children by key. | ||
- h3: visit | ||
|
||
- p: > | ||
Walk Nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
index: | ||
title: A minimal and powerful treemap component. | ||
body: | ||
- h1: Squarified | ||
- p: A treemap layout algorithm that optimizes for aspect ratio. | ||
|
||
- p: "Major features:" | ||
- ul: | ||
- "Minimalistic API" | ||
- "Powerful layout algorithm" | ||
- "Highly customizable" | ||
- "Supports zooming and panning" | ||
|
||
- p: > | ||
Check out the [getting started](/getting-started) guide to learn how to use. | ||
getting-started: "getting-started.yaml" | ||
api: "api.yaml" | ||
faq: "faq.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
title: Getting Started | ||
body: | ||
- h1: Getting Started | ||
|
||
- h2: Install squarified | ||
|
||
- p: > | ||
First, download and install this package from [npm](https://docs.npmjs.com/cli/v8/commands/npm-install) | ||
- pre.shell: > | ||
$ npm install squarified | ||
- h2: The first application | ||
|
||
- p: > | ||
This is a simple example of how to use it. Create a new file named `index.html` and `pre.js` in the same directory. | ||
copy and paste the following code into the files respectively and then run the `index.html` by a static server. (such as `npx http-server`) | ||
- pre.html: | | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Squarified</title> | ||
<style> | ||
#app, html, body { | ||
width: 100%; | ||
height: 100vh; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="pre.js"></script> | ||
</body> | ||
</html> | ||
- pre.js: | | ||
// pre.js | ||
import { createTreemap, presetDecorator } from 'squarified' | ||
const data = [{ | ||
name: 'root', | ||
weight: 100, | ||
groups: [ | ||
{ name: 'a', weight: 10 }, | ||
{ name: 'b', weight: 20 }, | ||
{ name: 'c', weight: 30 }, | ||
{ name: 'd', weight: 40 }, | ||
] | ||
}] | ||
const treemap = createTreemap() | ||
treemap.use('decorator', presetDecorator()) | ||
const el = document.getElementById('app') | ||
treemap.init(el) | ||
treemap.setOptions({ data }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
index: | ||
title: A minimal and powerful treemap component. | ||
body: | ||
- h1: Squarified | ||
- p: A treemap layout algorithm that optimizes for aspect ratio. | ||
|
||
- p: "Major features:" | ||
- ul: | ||
- "Minimalistic API" | ||
- "Powerful layout algorithm(Based on <a href='https://vanwijk.win.tue.nl/stm.pdf'>Squarified Treemaps</a>)" | ||
- "Highly customizable" | ||
- "Supports zooming and panning" | ||
|
||
- p: > | ||
Check out the [getting started](/getting-started) guide to learn how to use. | ||
getting-started: "getting-started.yaml" | ||
api: "api.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
type Any = any | ||
|
||
type AnyObject = Record<keyof Any, Any> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.