Skip to content

Commit

Permalink
chore: update version nums
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyan-Wang committed Mar 23, 2021
1 parent cf847f5 commit 5dd3288
Show file tree
Hide file tree
Showing 13 changed files with 196 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
"dependencies": {
"@antv/g-base": "^0.5.1",
"@antv/g6-core": "*",
"@antv/g6-core": "0.2.2",
"@antv/util": "~2.0.5"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/g6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
]
},
"dependencies": {
"@antv/g6-pc": "*"
"@antv/g6-pc": "0.2.2"
},
"devDependencies": {
"@babel/core": "^7.7.7",
Expand Down
6 changes: 3 additions & 3 deletions packages/pc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
"@antv/g-canvas": "^0.5.2",
"@antv/g-math": "^0.1.1",
"@antv/g-svg": "^0.5.1",
"@antv/g6-core": "*",
"@antv/g6-plugin": "*",
"@antv/g6-element": "*",
"@antv/g6-core": "0.2.2",
"@antv/g6-plugin": "0.2.2",
"@antv/g6-element": "0.2.2",
"@antv/algorithm": "^0.1.5",
"@antv/hierarchy": "^0.6.7",
"@antv/layout": "^0.1.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@antv/g-base": "^0.5.1",
"@antv/g-canvas": "^0.5.2",
"@antv/g-svg": "^0.5.2",
"@antv/g6-core": "*",
"@antv/g6-core": "0.2.2",
"@antv/matrix-util": "^3.0.4",
"@antv/scale": "^0.3.4",
"@antv/util": "^2.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/site/docs/api/graphLayout/comboForce.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: ComboForce
order: 11
order: 12
---

_It is a new feature of V3.5._ Combo Force is designed for the graph with combos based on classical force directed layout algorith. It modifies the forces between nodes according to their combo infomation to achieve a final result with clustering nodes inside each combo and no overlappings.
Expand Down
37 changes: 37 additions & 0 deletions packages/site/docs/api/graphLayout/forceAtlas2.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Force Atlas 2
order: 11
---

_It is a new feature of V3.2.2._ FA2 is a kind of force directed layout, which performs better on the convergence and compactness.

<img src='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*MqwAQZLIVPwAAAAAAAAAAAAAARQnAQ' width=430 alt='img'/>

```javascript
const graph = new G6.Graph({
container: 'mountNode',
width: 1000,
height: 600,
layout: {
type: 'random',
width: 300,
height: 300,
},
});
```

## layoutCfg.center

**Type**: Array<br />**Example**: [ 0, 0 ]<br />**Default**: The center of the graph<br />**Required**: false<br />**Description**: The center of the layout

## layoutCfg.width

**Type**: Number<br />**Default**: The width of the graph<br />**Required**: false<br />**Description**: The width of the layout

## layoutCfg.height

**Type**: Number<br />**Default**: The height of the graph<br />**Required**: false<br />**Description**: The height of the layout

## layoutCfg.workerEnabled

**Type**: Boolean<br />**Default**: false<br />**Required**: false<br />**Description**: Whether to enable the web-worker in case layout calculation takes too long to block page interaction
93 changes: 93 additions & 0 deletions packages/site/docs/api/graphLayout/forceAtlas2.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: Force Atlas 2
order: 11
---

*V4.2.2 新增功能。*Force Atlas 2 是一种力导向布局的变形,比 force 收敛地更好,更紧凑。

<img src='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*MqwAQZLIVPwAAAAAAAAAAAAAARQnAQ' width=430 alt='img'/>

```javascript
const graph = new G6.Graph({
container: 'mountNode',
width: 1000,
height: 600,
layout: {
type: 'random',
width: 300,
height: 300,
},
});
```

## layoutCfg.center

**类型**: Array<br />**示例**[ 0, 0 ]<br />**默认值**:图的中心<br />**是否必须**:false<br />**说明**:布局的中心

## layoutCfg.width

**类型**: Number<br />**默认值**:图的宽度<br />**是否必须**:false<br />**说明**:布局的宽度范围

## layoutCfg.height

**类型**: Number<br />**默认值**:图的高度<br />**是否必须**:false<br />**说明**:布局的高度范围

## layoutCfg.workerEnabled

**类型**: Boolean<br />**默认值**: false<br />**是否必须**: false<br />**说明**: 是否启用 web-worker 以防布局计算时间过长阻塞页面交互

## layoutCfg.kr

**类型**: Number<br />**默认值**:5<br />**是否必须**:false<br />**说明**:斥力系数,可用于调整布局的紧凑程度。kr 越大,布局越松散

## layoutCfg.kg

**类型**: Number<br />**默认值**:5<br />**是否必须**:false<br />**说明**:重力系数。kg 越大,布局越聚集在中心

## layoutCfg.ks

**类型**: Number<br />**默认值**:0.1<br />**是否必须**:false<br />**说明**:控制迭代过程中,节点移动的速度

## layoutCfg.tao

**类型**: Number<br />**默认值**:0.1<br />**是否必须**:false<br />**说明**:迭代接近收敛时停止震荡的容忍度

## layoutCfg.mode

**类型**: 'normal' | 'linlog'<br />**默认值**:'normal'<br />**是否必须**:false<br />**说明**:'normal' 模式下,聚类将更加紧凑

## layoutCfg.preventOverlap

**类型**: boolean<br />**默认值**:false<br />**是否必须**:false<br />**说明**:是否防止节点重叠

## layoutCfg.dissuadeHubs

**类型**: boolean<br />**默认值**:false<br />**是否必须**:false<br />**说明**:是否打开 hub 模式。若为 true,相比与出度大的节点,入度大的节点将会有更高的优先级被放置在中心位置

## layoutCfg.barnesHut

**类型**: boolean<br />**默认值**:false<br />**是否必须**:false<br />**说明**:是否打开 barnes hut 加速,即四叉树加速。由于每次迭代需要更新构建四叉树,建议在较大规模图上打开

## layoutCfg.prune

**类型**: boolean<br />**默认值**:false<br />**是否必须**:false<br />**说明**:是否开启自动剪枝模式。默认情况下,当节点数量大于 100 时它将会被激活。注意,剪枝能够提高收敛速度,但可能会降低图的布局质量

## layoutCfg.maxIteration

**类型**: number<br />**默认值**:0<br />**是否必须**:false<br />**说明**:最大迭代次数,若为 0 则将自动调整

## layoutCfg.getWidth

**类型**: function<br />**默认值**:undefined<br />**是否必须**:false<br />**说明**:节点宽度的函数,参数为节点数据

## layoutCfg.getHeight

**类型**: function<br />**默认值**:undefined<br />**是否必须**:false<br />**说明**:节点高度的函数,参数为节点数据

## layoutCfg.onLayoutEnd

**类型**: function<br />**默认值**:undefined<br />**是否必须**:false<br />**说明**:布局结束后的回调函数

## layoutCfg.onTick

**类型**: function<br />**默认值**:undefined<br />**是否必须**:false<br />**说明**:布局每次迭代的回调函数
1 change: 1 addition & 0 deletions packages/site/docs/api/graphLayout/guide.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Notice that the layouts for Graph cannot be used on TreeGraph.
- [Random Layout](./random): Randomizes the node postions;
- [GForce Layout](./gforce): Classical force-directed layout supports GPU parallel computing, supported by G6 4.0;
- [Force Layout](./force): Classical force-directed layout;
- [Force Atlas 2 Layout](./forceAtlas2): FA2 is a kind of force directed layout, which performs better on the convergence and compactness;
- [Fruchterman Layout](./fruchterman): A kind of force-directed layout;
- [Circular Layout](./circular): Arranges the nodes on a circle;
- [Radial Layout](./radial): Arranges the nodes around a focus node radially;
Expand Down
1 change: 1 addition & 0 deletions packages/site/docs/api/graphLayout/guide.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ G6 提供了以下内置布局算法。可以在[实例化图时配置](#实例
> 力导向布局:一个布局网络中,粒子与粒子之间具有引力和斥力,从初始的随机无序的布局不断演变,逐渐趋于平衡稳定的布局方式称之为力导向布局。适用于描述事物间关系,比如人物关系、计算机网络关系等。
- [Force Layout](./force):引用 d3 的经典力导向布局;
- [Force Atlas 2 Layout](./forceAtlas2):FA2 力导向布局,比 force 收敛地更好,更紧凑;
- [Circular Layout](./circular):环形布局;
- [Radial Layout](./radial):辐射状布局;
- [MDS Layout](./mds):高维数据降维算法布局;
Expand Down
6 changes: 6 additions & 0 deletions packages/site/examples/net/forceDirected/API.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
title: API
---

# Force Layout

`markdown:docs/api/graphLayout/force.zh.md`

# Force Atlas 2 Layout

`markdown:docs/api/graphLayout/forceAtlas2.zh.md`
42 changes: 42 additions & 0 deletions packages/site/examples/net/forceDirected/demo/basicFA2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import G6 from '@antv/g6';

const container = document.getElementById('container');
const width = container.scrollWidth;
const height = container.scrollHeight || 500;
const graph = new G6.Graph({
container: 'container',
width,
height,
modes: {
default: ['zoom-canvas', 'drag-canvas', 'drag-node'],
},
layout: {
type: 'forceAtlas2',
preventOverlap: true,
kr: 10,
center: [250, 250],
},
defaultNode: {
size: 20,
},
});

fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/relations.json')
.then((res) => res.json())
.then((data) => {
data.nodes.forEach(node => {
node.x = Math.random() * 1;
});
graph.on('afterlayout', e => {
graph.fitView()
})
graph.data(data);
graph.render();
});

if (typeof window !== 'undefined')
window.onresize = () => {
if (!graph || graph.get('destroyed')) return;
if (!container || !container.scrollWidth || !container.scrollHeight) return;
graph.changeSize(container.scrollWidth, container.scrollHeight);
};
8 changes: 8 additions & 0 deletions packages/site/examples/net/forceDirected/demo/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
},
"screenshot": "https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*Ce2WSIlo_fcAAAAAAAAAAABkARQnAQ"
},
{
"filename": "basicFA2.js",
"title": {
"zh": "基本 Force Atlas 2",
"en": "Basic Force-Atlas 2 Layout"
},
"screenshot": "https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*MqwAQZLIVPwAAAAAAAAAAAAAARQnAQ"
},
{
"filename": "forceDirectedPreventOverlap.js",
"title": {
Expand Down
2 changes: 1 addition & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@antv/chart-node-g6": "^0.0.3",
"@antv/util": "^2.0.9",
"@antv/g6": "*",
"@antv/g6": "4.2.2",
"@antv/gatsby-theme-antv": "1.1.1",
"gatsby": "^2.24.40",
"gh-pages": "^2.1.1",
Expand Down

0 comments on commit 5dd3288

Please sign in to comment.