# hd-topo

> 用于绘制拓扑图

Latest version **0.6.0** (published 2019-10-12) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install hd-topo
pnpm add hd-topo
yarn add hd-topo
bun add hd-topo
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2019-10-12 |
| First published | 2019-10-12 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 33.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | HDVON |
| Maintainers | hdvon-front-end |

## Links

- npm: https://www.npmjs.com/package/hd-topo
- npm.io page: https://npm.io/package/hd-topo

## Dependencies (3)

- [d3](https://npm.io/package/d3.md) ^5.9.1
- [pixi.js](https://npm.io/package/pixi.js.md) ^5.1.0
- [@types/d3](https://npm.io/package/@types/d3.md) ^5.7.2

## Recent versions

- 0.6.0 (latest) — 2019-10-12

## README

## Hd-Topo

- 此库使用[PIXI](https://github.com/pixijs/pixi.js/)， 使用webgl绘制2D的形式，用来绘制拓扑图；
- 使用了[d3-force](https://github.com/d3/d3-force)力导引布局，自动计算位置；
- 使用了[d3-zoom](https://github.com/d3/d3/blob/f025ca4ed8e66184b0ca3308eda5d91c5ba66834/API.md#zooming-d3-zoom), 计算zoom；

+ 推荐使用npm的方式安装，如
```$xslt
npm install hd-topo
```
#### 配置 webpack，全局注入PIXI 、d3
```$xslt
npm install pixijs
npm install d3
```
```$xslt
plugins: [
    // 全局注入
    new webpack.ProvidePlugin({
      PIXI: 'pixi.js',
      d3: 'd3'
    })
]
```
#### Hello world
```$xslt
import App from 'hd-topo'
const app = new App(
    document.getElementById('app'), // dom 容器，装载canvas
)
app
   .draw(data) // 先绘画图像，才能计算位置
   .generate(data) // 计算节点位置
   .bindZoom() // 添加zoom事件
```

详细文档见：

---
_Source: https://npm.io/package/hd-topo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
