Skip to content

Commit 7880fdd

Browse files
committed
docs: label-line 类型定义补全
1 parent 9836e08 commit 7880fdd

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

docs/common/label.en.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@
77
| offsetX | _number_ | The offset distance of the label from the data point in the X direction |
88
| offsetY | _number_ | The offset distance of the label from the data point in the Y direction |
99
| content | _string \| IGroup \| IShape \| GeometryLabelContentCallback_ | Text content that is displayed, if not declared, is displayed according to the value of the first field participating in the mapping |
10-
| style | object | Label text graphic property style |
10+
| style | _ShapeAttrs_ | Label text graphic property style |
1111
| autoRotate | _string_ | Whether to rotate automatically, default true |
1212
| rotate | _number_ | Text rotation Angle |
13-
| labelLine | _null \| \_boolean_ \|object\_ | Used to set the style property of the text connector. NULL indicates that it is not displayed. |
13+
| labelLine | _null \| \_boolean_ \|LabelLineCfg\_ | Used to set the style property of the text connector. NULL indicates that it is not displayed. |
1414
| labelEmit | _boolean_ | Only applies to text in polar coordinates, indicating whether the text is radially displayed according to the Angle. True means on and false means off |
1515
| layout | _'overlap' \| 'fixedOverlap' \| 'limitInShape'_ | Text layout type, support a variety of layout function combination. |
1616
| position | _'top' \| 'bottom' \| 'middle' \| 'left' \| 'right'_ | Specifies the position of the current Label relative to the current graphic |
1717
| animate | _boolean \| AnimateOption_ | Animation configuration. |
1818
| formatter | _Function_ | Format function |
1919
| autoHide | _boolean_ | Whether to hide it automatically, default to false |
2020

21+
__*LabelLineCfg*__ 类型定义如下, 关于 _ShapeAttrs_ 详细查看 [ShapeAttrs](/zh/docs/api/shape/shape-attrs) 文档:
22+
23+
```plain
24+
type LabelLineCfg = {
25+
style?: ShapeAttrs;
26+
}
27+
```
28+
2129
Example code:
2230

2331
```ts

docs/common/label.zh.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@
77
| offsetX | _number_ | label 相对于数据点在 X 方向的偏移距离 |
88
| offsetY | _number_ | label 相对于数据点在 Y 方向的偏移距离 |
99
| content | _string \| IGroup \| IShape \| GeometryLabelContentCallback_ | 展示的文本内容,如果不声明则按照参与映射的第一字段的值进行显示 |
10-
| style | object | label 文本图形属性样式 |
10+
| style | _ShapeAttrs_ | label 文本图形属性样式 |
1111
| autoRotate | _string_ | 是否自动旋转,默认 true |
1212
| rotate | _number_ | 文本旋转角度 |
13-
| labelLine | _null \| _boolean_ \|object_ | 用于设置文本连接线的样式属性,null 表示不展示。 |
13+
| labelLine | _null \| _boolean_ \| LabelLineCfg_ | 用于设置文本连接线的样式属性,null 表示不展示。 |
1414
| labelEmit | _boolean_ | 只对极坐标下的文本生效,表示文本是否按照角度进行放射状显示,true 表示开启,false 表示关闭 |
1515
| layout | _'overlap' \| 'fixedOverlap' \| 'limitInShape'_ | 文本布局类型,支持多种布局函数组合使用。 |
1616
| position | _'top' \| 'bottom' \| 'middle' \| 'left' \| 'right'_ | 指定当前 label 与当前图形的相对位置 |
1717
| animate | _boolean \| AnimateOption_ | 动画配置。 |
1818
| formatter | _Function_ | 格式化函数 |
1919
| autoHide | _boolean_ | 是否自动隐藏,默认 false |
2020

21+
__*LabelLineCfg*__ 类型定义如下, 关于 _ShapeAttrs_ 详细查看 [ShapeAttrs](/zh/docs/api/shape/shape-attrs) 文档:
22+
23+
```plain
24+
type LabelLineCfg = {
25+
style?: ShapeAttrs;
26+
}
27+
```
28+
2129
示例代码:
2230

2331
```ts

src/adaptor/geometries/base.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ export function geometry<O extends GeometryOptions>(params: Params<O>): Params<O
144144
const { color, shape, size, style, tooltip } = mapping;
145145

146146
// 创建 geometry
147-
const geometry = chart[type](args).position(`${xField}*${yField}`);
147+
const geometry = chart
148+
.area({
149+
...args,
150+
startOnZero: false,
151+
})
152+
.position(`${xField}*${yField}`);
148153

149154
/**
150155
* color 的几种情况

src/plots/area/adaptor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function adaptor(params: Params<AreaOptions>) {
131131
// flow 的方式处理所有的配置到 G2 API
132132
return flow(
133133
geometry,
134-
meta,
134+
// meta,
135135
adjust,
136136
theme,
137137
axis,

src/plots/line/adaptor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function meta(params: Params<LineOptions>): Params<LineOptions> {
6565
[xField]: {
6666
type: 'cat',
6767
},
68-
[yField]: adjustYMetaByZero(data, yField),
68+
// [yField]: adjustYMetaByZero(data, yField),
6969
}
7070
)
7171
)(params);

0 commit comments

Comments
 (0)