From 1b039b0b865dc84a01370c9f701b2c2a8792e23d Mon Sep 17 00:00:00 2001 From: Visiky <736929286@qq.com> Date: Wed, 21 Jul 2021 14:33:51 +0800 Subject: [PATCH] =?UTF-8?q?docs(legend):=20=E5=9B=BE=E4=BE=8B=20itemName,?= =?UTF-8?q?=20itemValue=20=E5=A2=9E=E5=8A=A0=20style=20=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=20(#2712)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/common/legend-cfg.en.md | 74 ++++++++++++++++++++++++++++++------ docs/common/legend-cfg.zh.md | 58 ++++++++++++++++++++++++++-- 2 files changed, 116 insertions(+), 16 deletions(-) diff --git a/docs/common/legend-cfg.en.md b/docs/common/legend-cfg.en.md index 3a88a18b4f..e9fd4e49c0 100644 --- a/docs/common/legend-cfg.en.md +++ b/docs/common/legend-cfg.en.md @@ -121,25 +121,75 @@ Apply to Classification legend**optional** _LegendItemNameCfg_ -Apply to Classification legend, configure the legend item name text. _LegendItemNameCfg_ is configured as follows: +适用于 分类图例,图例项 name 文本的配置。_LegendItemNameCfg_ 配置如下: -| Properties | Type | Default | Description | -| ---------- | ---------- | ------- | -------------------------------------------------------------------------------- | -| style | _object_ | - | Text style configuration, referecnce [Graphic Style](/zh/docs/api/graphic-style) | -| spacing | _number_ | `false` | The spacing between legend item marker and the following name | -| formatter | _function_ | - | Format function, `(text: string, item: ListItem, index: number) => any;` | +| 参数名 | 类型 | 默认值 | 描述 | +| --------- | ---------- | ------- | ------------------------------------------------------------------- | +| style | _((item: ListItem, index: number, items: ListItem[]) => ShapeAttrs) \| ShapeAttrs_ | | - | 文本样式配置项 | +| spacing | number | | - | 图例项 marker 同后面 name 的间距 | +| formatter | `(text: string, item: ListItem, index: number) => any;` | | | 格式化函数 | + +其中, `ShapeAttrs` 详细配置见:[文档](/zh/docs/api/shape/shape-attrs);`ListItem` 配置如下: + +```ts +type ListItem = { + /** + * 名称 {string} + */ + name: string; + /** + * 值 {any} + */ + value: any; + /** + * 图形标记 {object|string} + */ + marker?: Marker | string; +} + +type Marker = { + symbol? string; + style?: ShapeAttrs; + spacing?: number; +}; +``` ##### itemValue **optional** _LegendItemValueCfg_ -Apply to Classification legend, configuration item of legend item Value added value. _LegendItemValueCfg_ Configuration is as follows: +适用于 分类图例,图例项 value 附加值的配置项。_LegendItemValueCfg_ 配置如下: -| Properties | Type | Default | Description | -| ---------- | ---------- | ------- | ------------------------------------------------------------------------------------ | -| style | _object_ | - | Text style configuration item, reference [Graphic Style](/zh/docs/api/graphic-style) | -| alignRight | _boolean_ | `false` | Right-align, false by default, only when setting legend item width. | -| formatter | _function_ | - | Format function, `(text: string, item: ListItem, index: number) => any;` | +| 参数名 | 类型 | 默认值 | 描述 | +| ---------- | ---------- | ------- | ------------------------------------------------------------------- | +| alignRight | _boolean_ | `false` | 是否右对齐,默认为 false,仅当设置图例项宽度时生效 | +| formatter | _function_ | - | 格式化函数, `(text: string, item: ListItem, index: number) => any;` | +| style | _((item: ListItem, index: number, items: ListItem[]) => ShapeAttrs) \| ShapeAttrs_ | | - | 文本样式配置项 | + +其中, `ShapeAttrs` 详细配置见:[文档](/zh/docs/api/shape/shape-attrs);`ListItem` 配置如下: + +```ts +type ListItem = { + /** + * 名称 {string} + */ + name: string; + /** + * 值 {any} + */ + value: any; + /** + * 图形标记 {object|string} + */ + marker?: Marker | string; +} + +type Marker = { + symbol? string; + style?: ShapeAttrs; + spacing?: number; +}; +``` diff --git a/docs/common/legend-cfg.zh.md b/docs/common/legend-cfg.zh.md index 1ad1538d09..90d8f6b5c7 100644 --- a/docs/common/legend-cfg.zh.md +++ b/docs/common/legend-cfg.zh.md @@ -129,9 +129,34 @@ pageNavigator: { | 参数名 | 类型 | 默认值 | 描述 | | --------- | ---------- | ------- | ------------------------------------------------------------------- | -| style | _object_ | - | 文本样式配置项,参考  [绘图属性](/zh/docs/api/graphic-style) | -| spacing | _number_ | `false` | 图例项 marker 同后面 name 的间距 | -| formatter | _function_ | - | 格式化函数, `(text: string, item: ListItem, index: number) => any;` | +| style | _((item: ListItem, index: number, items: ListItem[]) => ShapeAttrs) \| ShapeAttrs_ | | - | 文本样式配置项 | +| spacing | number | | - | 图例项 marker 同后面 name 的间距 | +| formatter | `(text: string, item: ListItem, index: number) => any;` | | | 格式化函数 | + +其中, `ShapeAttrs` 详细配置见:[文档](/zh/docs/api/shape/shape-attrs);`ListItem` 配置如下: + +```ts +type ListItem = { + /** + * 名称 {string} + */ + name: string; + /** + * 值 {any} + */ + value: any; + /** + * 图形标记 {object|string} + */ + marker?: Marker | string; +} + +type Marker = { + symbol? string; + style?: ShapeAttrs; + spacing?: number; +}; +``` ##### itemValue @@ -141,9 +166,34 @@ pageNavigator: { | 参数名 | 类型 | 默认值 | 描述 | | ---------- | ---------- | ------- | ------------------------------------------------------------------- | -| style | _object_ | - | 文本样式配置项,详见  [绘图属性](/zh/docs/api/graphic-style) | | alignRight | _boolean_ | `false` | 是否右对齐,默认为 false,仅当设置图例项宽度时生效 | | formatter | _function_ | - | 格式化函数, `(text: string, item: ListItem, index: number) => any;` | +| style | _((item: ListItem, index: number, items: ListItem[]) => ShapeAttrs) \| ShapeAttrs_ | | - | 文本样式配置项 | + +其中, `ShapeAttrs` 详细配置见:[文档](/zh/docs/api/shape/shape-attrs);`ListItem` 配置如下: + +```ts +type ListItem = { + /** + * 名称 {string} + */ + name: string; + /** + * 值 {any} + */ + value: any; + /** + * 图形标记 {object|string} + */ + marker?: Marker | string; +} + +type Marker = { + symbol? string; + style?: ShapeAttrs; + spacing?: number; +}; +```