Skip to content

Commit

Permalink
chore: update site
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfu1 committed Oct 9, 2024
1 parent 628330c commit ca2d29c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 27 deletions.
23 changes: 4 additions & 19 deletions site/docs/manual/getting-started.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,20 @@ npm install @ant-design/charts --save
import { Line } from '@ant-design/charts';
```

前置依赖
```ts
"peerDependencies": {
"react": ">=16.8.4",
"react-dom": ">=16.8.4"
}
```

在需求明确的情况下,也可仅引入相关子包

```bash
# 统计图表
npm install @ant-design/plots --save
```

### 方式二:浏览器引入

既可以通过将脚本下载到本地也可以直接引入在线资源。

```ts
// Plots 相关的图表
<script type="text/javascript" src="https://unpkg.com/@ant-design/plots@latest/dist/plots.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/@ant-design/charts@latest/dist/charts.min.js"></script>
```

由于 @ant-design/charts 里面 externals 了 `react``react-dom`,使用时需要通过 CDN 的方式在 `charts.min.js` 之前引入对应包的 CDN 地址。
Expand All @@ -54,25 +47,17 @@ externals: {
<script crossorigin src="https://unpkg.com/react-dom@latest/umd/react-dom.production.min.js"></script>

// 按需引入
<script type="text/javascript" src="https://unpkg.com/@ant-design/plots@latest/dist/plots.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/@ant-design/charts@latest/dist/charts.min.js"></script>
```

使用方式

```ts
// 折线图,其它图表类似
const { Line } = window.Plots;
const { Line } = window.Charts;
```


```html
<!-- 下载到本地 引入本地脚本 -->
<script src="./plots.min.js"></script>
<script>
const { Line } = window.Plots;
</script>
```

## 快速使用

在 Ant Design Charts 引入页面后,我们就已经做好了创建第一个图表的准备了,下面以一个基础折线图为例开始我们第一个图表的创建。大部分 demos 使用了父容器宽高,请确保父容器宽高或者手动设置图表宽高。
Expand Down
41 changes: 40 additions & 1 deletion site/docs/manual/introduction.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,46 @@ redirect_from:

<br /> 像使用组件一样生成图表,开箱即用,你甚至不需要修改任何配置项就可以满足需求,真正的默认好用,有没有心动想试试的感觉。

<br />![image.png](https://gw.alipayobjects.com/zos/antfincdn/TcUwTMuNxI/0a9ac684-e862-4889-b783-e0a75a0e3138.png#align=left&display=inline&height=951&name=image.png&originHeight=1901&originWidth=2000&size=968667&status=done&style=none&width=1000)
#### 依赖关系

<table style="width:100%; margin: 0">
<tr>
<td>主包</td>
<td>子包/依赖</td>
<td>描述</td>
</tr>
<tr>
<td rowspan="2">@ant-design/charts</td>
<td>@ant-design/plots</td>
<td>统计图表</td>
</tr>
<tr>
<td>@ant-design/graphs</td>
<td>关系图</td>
</tr>
</table>

#### 概览

<div style="display: flex; width: 100%;">
<div style="flex: 1">
<h5 style="text-align: center; margin: 0">统计图表</h5>
</div>
<div style="flex: 1">
<h5 style="text-align: center; margin: 0">关系图</h5>
</div>
</div>
<div style="display: flex; width: 100%; max-height: 600px">
<div style="flex: 1">
<img style="height: 100%" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*yzh-S5AM5IEAAAAAAAAAAAAADmJ7AQ/original" />
</div>
<div style="width: 1px; margin: 0 12px; background: rgb(222 219 219)"></div>
<div style="flex: 1">
<img style="height: 100%" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*MUsJRaqx8BUAAAAAAAAAAAAADmJ7AQ/original" />
</div>
</div>

<!-- <br />![image.png](https://gw.alipayobjects.com/zos/antfincdn/TcUwTMuNxI/0a9ac684-e862-4889-b783-e0a75a0e3138.png#align=left&display=inline&height=951&name=image.png&originHeight=1901&originWidth=2000&size=968667&status=done&style=none&width=1000) -->

### 架构

Expand Down
16 changes: 9 additions & 7 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@
"start": "cross-env NODE_OPTIONS=--max_old_space_size=8192 pnpm run develop"
},
"devDependencies": {
"@antv/dumi-theme-antv": "^0.5.2",
"@types/react": "^16.14.61",
"@types/react-dom": "^16.9.24",
"@antv/dumi-theme-antv": "^0.5.0",
"@types/react": "^16.14.8",
"@types/react-dom": "^16.9.13",
"cross-env": "^7.0.3",
"d3-interpolate": "^3.0.1",
"d3-regression": "^1.3.10",
"dumi": "^2.4.10",
"dumi": "^2.1.14",
"fecha": "^4.2.3",
"gh-pages": "^2.2.0",
"typedoc": "^0.17.8",
"typedoc-plugin-markdown": "^2.4.2"
"gh-pages": "^2.1.1",
"typedoc": "^0.17.6",
"typedoc-plugin-markdown": "^2.2.11",
"typescript": "^3.6.5"
},
"dependencies": {
"@ant-design/graphs": "workspace:*",
Expand Down

0 comments on commit ca2d29c

Please sign in to comment.