Skip to content

Commit

Permalink
refactor: add minimap demo, update api doc (#6550)
Browse files Browse the repository at this point in the history
* refactor: add minimap demo

* refactor: update api doc
  • Loading branch information
Aarebecca authored Nov 26, 2024
1 parent b329c55 commit 27ede33
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/g6/src/runtime/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export class Graph extends EventEmitter {
* <zh/> 获取插件实例
*
* <en/> Get plugin instance
* @param key - <zh/> 插件 key | <en/> plugin key
* @param key - <zh/> 插件 key(在配置 plugin 时需要手动传入指定) | <en/> plugin key(need to be specified manually when configuring plugin)
* @returns <zh/> 插件实例 | <en/> plugin instance
* @remarks
* <zh/> 一些插件提供了 API 方法可供调用,例如全屏插件可以调用 `request` 和 `exit` 方法来请求和退出全屏
Expand Down
22 changes: 22 additions & 0 deletions packages/site/examples/plugin/minimap/demo/basic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Graph } from '@antv/g6';

const graph = new Graph({
container: 'container',
data: { nodes: Array.from({ length: 20 }).map((_, i) => ({ id: `node${i}` })) },
behaviors: ['drag-canvas', 'zoom-canvas', 'drag-element'],
plugins: [
{
type: 'minimap',
size: [240, 160],
},
],
node: {
palette: 'spectral',
},
layout: {
type: 'circular',
},
autoFit: 'view',
});

graph.render();
16 changes: 16 additions & 0 deletions packages/site/examples/plugin/minimap/demo/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"title": {
"zh": "中文分类",
"en": "Category"
},
"demos": [
{
"filename": "basic.js",
"title": {
"zh": "小地图",
"en": "Minimap"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*asv5Roh25YkAAAAAAAAAAAAADmJ7AQ/original"
}
]
}
3 changes: 3 additions & 0 deletions packages/site/examples/plugin/minimap/index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Minimap
---
3 changes: 3 additions & 0 deletions packages/site/examples/plugin/minimap/index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Minimap 小地图
---

0 comments on commit 27ede33

Please sign in to comment.