Skip to content

Commit

Permalink
docs: add site demos (#2707)
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonneyx authored Sep 24, 2024
1 parent aa86178 commit 5b3b09b
Show file tree
Hide file tree
Showing 47 changed files with 1,727 additions and 1 deletion.
1 change: 1 addition & 0 deletions site/.dumi/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if (window) {
(window as any).lodashEs = require('lodash');
/** 不要使用 link, react-dom 冲突 */
(window as any).plots = require('@ant-design/plots');
(window as any).graphs = require('@ant-design/graphs');
(window as any).d3Interpolate = require('d3-interpolate');
(window as any).d3Regression = require('d3-regression');
}
8 changes: 8 additions & 0 deletions site/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ export default defineConfig({
en: 'Statistics',
},
},
{
slug: 'relations',
icon: 'line',
title: {
zh: '关系图表',
en: 'Relations',
},
},
],
detail: {
engine: {
Expand Down
24 changes: 24 additions & 0 deletions site/examples/relations/dendrogram/demo/horizontal-dendrogram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Dendrogram, G6 } from '@ant-design/graphs';
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';

const { treeToGraphData } = G6;

const DemoDendrogram = () => {
const [data, setData] = useState(undefined);

useEffect(() => {
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => setData(treeToGraphData(data)));
}, []);

const options = {
autoFit: 'view',
data,
};

return <Dendrogram {...options} />;
};

ReactDOM.render(<DemoDendrogram />, document.getElementById('container'));
25 changes: 25 additions & 0 deletions site/examples/relations/dendrogram/demo/horizontal-tidy-tree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Dendrogram, G6 } from '@ant-design/graphs';
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';

const { treeToGraphData } = G6;

const DemoDendrogram = () => {
const [data, setData] = useState(undefined);

useEffect(() => {
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => setData(treeToGraphData(data)));
}, []);

const options = {
autoFit: 'view',
data,
compact: true,
};

return <Dendrogram {...options} />;
};

ReactDOM.render(<DemoDendrogram />, document.getElementById('container'));
56 changes: 56 additions & 0 deletions site/examples/relations/dendrogram/demo/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"title": {
"zh": "中文分类",
"en": "Category"
},
"demos": [
{
"filename": "horizontal-dendrogram.js",
"title": {
"zh": "水平生态树",
"en": "Horizontal Dendrogram"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*rRlBRIOnCjoAAAAAAAAAAAAADmJ7AQ/original"
},
{
"filename": "vertical-dendrogram.js",
"title": {
"zh": "垂直生态树",
"en": "Vertical Dendrogram"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*Xzf1SKVmNxIAAAAAAAAAAAAADmJ7AQ/original"
},
{
"filename": "radial-dendrogram.js",
"title": {
"zh": "径向生态树",
"en": "Radial Dendrogram"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*mvnUTaA91H0AAAAAAAAAAAAADmJ7AQ/original"
},
{
"filename": "horizontal-tidy-tree.js",
"title": {
"zh": "水平紧凑树",
"en": "Horizontal Tidy Tree"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*3u63Q4dYzMQAAAAAAAAAAAAADmJ7AQ/original"
},
{
"filename": "vertical-tidy-tree.js",
"title": {
"zh": "垂直紧凑树",
"en": "Vertical Tidy Tree"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*GbheQoWEWREAAAAAAAAAAAAADmJ7AQ/original"
},
{
"filename": "radial-tidy-tree.js",
"title": {
"zh": "径向紧凑树",
"en": "Radial Tidy Tree"
},
"screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*6xYwTbcLp20AAAAAAAAAAAAADmJ7AQ/original"
}
]
}
25 changes: 25 additions & 0 deletions site/examples/relations/dendrogram/demo/radial-dendrogram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Dendrogram, G6 } from '@ant-design/graphs';
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';

const { treeToGraphData } = G6;

const DemoDendrogram = () => {
const [data, setData] = useState(undefined);

useEffect(() => {
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => setData(treeToGraphData(data)));
}, []);

const options = {
autoFit: 'view',
data,
direction: 'radial',
};

return <Dendrogram {...options} />;
};

ReactDOM.render(<DemoDendrogram />, document.getElementById('container'));
26 changes: 26 additions & 0 deletions site/examples/relations/dendrogram/demo/radial-tidy-tree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Dendrogram, G6 } from '@ant-design/graphs';
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';

const { treeToGraphData } = G6;

const DemoDendrogram = () => {
const [data, setData] = useState(undefined);

useEffect(() => {
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => setData(treeToGraphData(data)));
}, []);

const options = {
autoFit: 'view',
data,
direction: 'radial',
compact: true,
};

return <Dendrogram {...options} />;
};

ReactDOM.render(<DemoDendrogram />, document.getElementById('container'));
25 changes: 25 additions & 0 deletions site/examples/relations/dendrogram/demo/vertical-dendrogram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Dendrogram, G6 } from '@ant-design/graphs';
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';

const { treeToGraphData } = G6;

const DemoDendrogram = () => {
const [data, setData] = useState(undefined);

useEffect(() => {
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => setData(treeToGraphData(data)));
}, []);

const options = {
autoFit: 'view',
data,
direction: 'vertical',
};

return <Dendrogram {...options} />;
};

ReactDOM.render(<DemoDendrogram />, document.getElementById('container'));
26 changes: 26 additions & 0 deletions site/examples/relations/dendrogram/demo/vertical-tidy-tree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Dendrogram, G6 } from '@ant-design/graphs';
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';

const { treeToGraphData } = G6;

const DemoDendrogram = () => {
const [data, setData] = useState(undefined);

useEffect(() => {
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => setData(treeToGraphData(data)));
}, []);

const options = {
autoFit: 'view',
data,
direction: 'vertical',
compact: true,
};

return <Dendrogram {...options} />;
};

ReactDOM.render(<DemoDendrogram />, document.getElementById('container'));
4 changes: 4 additions & 0 deletions site/examples/relations/dendrogram/index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Dendrogram
order: 2
---
4 changes: 4 additions & 0 deletions site/examples/relations/dendrogram/index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 生态树
order: 2
---
Loading

0 comments on commit 5b3b09b

Please sign in to comment.