Skip to content

Commit

Permalink
feat: opt api (#2335)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfu1 authored Jan 4, 2024
1 parent a4c3b29 commit aaf19b2
Show file tree
Hide file tree
Showing 83 changed files with 204 additions and 119 deletions.
2 changes: 1 addition & 1 deletion site/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default defineConfig({
showLanguageSwitcher: true, // 是否显示官网语言切换
showWxQrcode: true, // 是否显示头部菜单的微信公众号
showChartResize: true, // 是否在 demo 页展示图表视图切换
showAPIDoc: true,
showAPIDoc: process.env.NODE_ENV === 'production', // 是否在 demo 页展示 API 说明
versions: {
[version]: 'https://ant-design-charts-next.antgroup.com',
'1.x': 'https://ant-design-charts.antgroup.com',
Expand Down
1 change: 1 addition & 0 deletions site/docs/options/plots/common/overview.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<embed src="@/docs/options/plots/common/overview.zh.md"></embed>
27 changes: 27 additions & 0 deletions site/docs/options/plots/common/overview.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 通用配置

<embed src="@/docs/options/plots/overview.zh.md"></embed>

# 坐标轴

<embed src="@/docs/options/plots/component/axis.zh.md"></embed>

# 图例

<embed src="@/docs/options/plots/component/legend.zh.md"></embed>

# 滚动条

<embed src="@/docs/options/plots/component/scrollbar.zh.md"></embed>

# 提示

<embed src="@/docs/options/plots/component/tooltip.zh.md"></embed>

# 数据标签

<embed src="@/docs/options/plots/label/overview.zh.md"></embed>

# 更多

详见[选项](/options)
46 changes: 23 additions & 23 deletions site/docs/options/plots/overview.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ title: 概览
order: 1
---

### 图表容器
## 图表容器

#### width
### width

<description>**optional** *number* *default:* `400`</description>

设置图表宽度。

#### height
### height

<description>**optional** *number* *default:* `400`</description>

设置图表高度。

#### autoFit
### autoFit

<description>**optional** *boolean* *default:* `true`</description>

图表是否自适应容器宽高。当 `autoFit` 设置为 true 时,`width``height` 的设置将失效。


#### renderer
### renderer

<description>**optional** *string* *default:* `canvas`</description>

设置图表渲染方式为 `canvas``svg`


### 视图模型
## 视图模型

G2 中的视图模型定义了一个视图的划分方式,划分得到的不同区域会绘制不同的东西,也通过不同的选项去设置。现在可以简单的把视图理解为一个图表。G2 的视图模型如下:

Expand Down Expand Up @@ -82,56 +82,56 @@ const contentHeight =
insetBottom;
```

### 数据映射
## 数据映射

#### data
### data

<description>**required** *array object*</description>

设置图表数据源。数据源为对象集合,例如:`[{ time: '1991',value: 20 }, { time: '1992',value: 20 }]`

#### xField
### xField

<description>**required** *string*</description>

图形在 x 方向对应的数据字段名,一般是横向的坐标轴对应的字段。比如:要看不同班级的人数情况,那么班级字段就是对应的 xField。

#### yField
### yField

<description>**required** *string*</description>

图形在 y 方向对应的数据字段名,一般是纵向的坐标轴对应的字段。比如:要看不同班级的人数情况,那么人数字段就是对应的 yField。


#### seriesField
### seriesField

<description>**optional** *string*</description>

分组字段。比如:我们需要分析不同`省份`的交易额趋势,那么`省份字段`就是分组字段。


### 图形样式
## 图形样式

#### shapeField
### shapeField

<description>**optional** *string* </description>

指定 line 是否平滑,点图形状等

#### colorField
### colorField

<description>**optional** *string* </description>

指定颜色通道字段


#### sizeField
### sizeField

<description>**optional** *string* </description>

指定尺寸通道字段

#### stack
### stack

<description>**optional** *boolean | StackYTransform*</description>

Expand All @@ -148,7 +148,7 @@ type StackYTransform = {
};
```

#### normalize
### normalize

<description>**optional** *boolean | NormalizeYTransform*</description>

Expand All @@ -162,7 +162,7 @@ type NormalizeYTransform = {
};
```

#### sort
### sort

<description>**optional** *boolean | SortByTransform*</description>

Expand All @@ -175,7 +175,7 @@ type SortByTransform = {
};
```

#### group
### group

<description>**optional** *boolean | DodgeXTransform*</description>

Expand All @@ -190,29 +190,29 @@ type DodgeXTransform = {
};
```

#### percent
### percent

<description>**optional** *boolean* *default:* `true`</description>

是否百分比面积图,百分比时默认开启 isStack。



#### line
### line

<description>**optional** *Line*</description>

线条,一般用于面积图中添加线条

#### point
### point

<description>**optional** *Point*</description>

点图形样式,一般用于 Line 中添加对应 Mark



### 状态
## 状态

<description>**可选** *object*</description>

Expand Down
4 changes: 3 additions & 1 deletion site/docs/options/plots/special/bar.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Bar
order: 0
---

#### markBackground
## 特有

### markBackground

<description>**optional** *BarOptions*</description>

Expand Down
6 changes: 4 additions & 2 deletions site/docs/options/plots/special/bidirectional-bar.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ title: BidirectionalBar
order: 3
---

#### yField
## 特有

### yField

<description>**optional** *string[]*</description>

Y 轴字段


#### layout
### layout

<description>**optional** *vertical | horizontal* **default** *vertical*</description>

Expand Down
4 changes: 3 additions & 1 deletion site/docs/options/plots/special/box.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Box
order: 4
---

#### boxType
## 特有

### boxType

<description>**optional** *boxplot | box* **default** *box*</description>

Expand Down
18 changes: 10 additions & 8 deletions site/docs/options/plots/special/bullet.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@ title: Bullet
order: 5
---

#### measureField
## 特有

### measureField

<description>**required** _string_</description>

使用数据条的长度,实际数值的设置字段,表示实际数值。

#### rangeField
### rangeField

<description>**required** _string_</description>

使用背景色条的长度的设置字段,表示区间范围。

#### targetField
### targetField

<description>**required** _string_</description>

使用测量标记的刻度轴位置的设置字段,表示目标值。

#### layout
### layout

<description>**optional** _'horizontal' | 'vertical'_ _default:_ 'horizontal'</description>

表示子弹图方向。


#### color
### color

<description>**optional** _object_</description>

Expand All @@ -41,20 +43,20 @@ order: 5
| target | _string\|string[]_ | 目标值颜色 ||


#### range
### range

<description>**required** _BulletOptions_</description>

range 配置

#### measure
### measure

<description>**required** _BulletOptions_</description>

measure 配置


#### target
### target

<description>**required** _BulletOptions_</description>

Expand Down
4 changes: 3 additions & 1 deletion site/docs/options/plots/special/column.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ order: 1
---


#### markBackground
## 特有

### markBackground

<description>**optional** *ColumnOptions*</description>

Expand Down
6 changes: 4 additions & 2 deletions site/docs/options/plots/special/funnel.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ title: Funnel
order: 6
---

#### compareField
## 特有

### compareField

<description>**optional** _string_</description>

对比字段。声明此字段时会自动渲染为对比漏斗图

#### isTransposed
### isTransposed

<description>**optional** _boolean_ _default:_ `false`</description>

Expand Down
4 changes: 3 additions & 1 deletion site/docs/options/plots/special/heatmap.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Heatmap
order: 7
---

#### mark
## 特有

### mark

<description>**optional** _string_</description>

Expand Down
8 changes: 5 additions & 3 deletions site/docs/options/plots/special/histogram.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ title: Histogram
order: 8
---

#### binField
## 特有

### binField

<description>**required** _string_</description>

设置直方图绘制 (进行分箱) 的字段。

#### binWidth
### binWidth

<description>**optional** _string_</description>

设置直方图的分箱宽度,binWidth 影响直方图分成多少箱, 不能与 binNumber 一起使用。

#### binNumber
### binNumber

<description>**optional** _number_</description>

Expand Down
4 changes: 3 additions & 1 deletion site/docs/options/plots/special/liquid.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ title: Liquid
order: 9
---

#### percent
## 特有

### percent

<description>**required** _number_</description>

Expand Down
Loading

0 comments on commit aaf19b2

Please sign in to comment.