From c0aa96881ea1e723c3975cc891101c536a724f60 Mon Sep 17 00:00:00 2001 From: kasmine <736929286@qq.com> Date: Wed, 20 Jan 2021 16:37:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(radial-bar):=20=E7=8E=89=E7=8F=8F?= =?UTF-8?q?=E5=9B=BE=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E8=A7=92=E5=BA=A6=E5=92=8C=E7=BB=93=E6=9D=9F=E8=A7=92=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plots/radial-bar/adaptor.ts | 4 +++- src/plots/radial-bar/types.ts | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plots/radial-bar/adaptor.ts b/src/plots/radial-bar/adaptor.ts index 07a4377e8d..baa6e386bd 100644 --- a/src/plots/radial-bar/adaptor.ts +++ b/src/plots/radial-bar/adaptor.ts @@ -61,7 +61,7 @@ export function meta(params: Params): Params */ function coordinate(params: Params): Params { const { chart, options } = params; - const { radius, innerRadius } = options; + const { radius, innerRadius, startAngle, endAngle } = options; chart .coordinate({ @@ -69,6 +69,8 @@ function coordinate(params: Params): Params cfg: { radius, innerRadius, + startAngle, + endAngle, }, }) .transpose(); diff --git a/src/plots/radial-bar/types.ts b/src/plots/radial-bar/types.ts index 1ca49bfca3..6bacfe18ed 100644 --- a/src/plots/radial-bar/types.ts +++ b/src/plots/radial-bar/types.ts @@ -16,6 +16,10 @@ export interface RadialBarOptions extends Options, Pick Date: Wed, 20 Jan 2021 19:08:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=E7=8E=89?= =?UTF-8?q?=E7=8F=8F=E5=9B=BE=E9=85=8D=E7=BD=AE=E5=9D=90=E6=A0=87=E7=B3=BB?= =?UTF-8?q?=E8=B5=B7=E5=A7=8B=E5=92=8C=E7=BB=88=E6=AD=A2=E8=A7=92=E5=BA=A6?= =?UTF-8?q?=E7=9A=84=E6=96=87=E6=A1=A3=20&=20axis=20=E6=B7=BB=E5=8A=A0=20l?= =?UTF-8?q?abel=20=E9=85=8D=E7=BD=AE=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/plots/radial-bar.en.md | 14 +++++++++++ docs/api/plots/radial-bar.zh.md | 14 +++++++++++ docs/common/axis.zh.md | 28 ++++++++++++++++----- examples/more-plots/radial-bar/demo/line.ts | 7 ++++-- 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/docs/api/plots/radial-bar.en.md b/docs/api/plots/radial-bar.en.md index 5528900bad..9794cbab53 100644 --- a/docs/api/plots/radial-bar.en.md +++ b/docs/api/plots/radial-bar.en.md @@ -33,6 +33,20 @@ Radius of Polar coordinate. Value can be: (0, 1] InnerRadius of Polar coordinate. Value can be: (0, 1] +#### startAngle + +**optional** _number_ _default:_ `-Math.PI / 2` + +配置坐标系的起始角度。 + +#### endAngle + +**optional** _number_ _default:_ `Math.PI / 2 * 3` + +配置坐标系的结束角度。 + + + #### maxAngle **optional** _number_ _default:_ `240` diff --git a/docs/api/plots/radial-bar.zh.md b/docs/api/plots/radial-bar.zh.md index 7c2f090d8d..b819964823 100644 --- a/docs/api/plots/radial-bar.zh.md +++ b/docs/api/plots/radial-bar.zh.md @@ -34,6 +34,20 @@ order: 25 功能描述: 内径,0 ~ 1。 +#### startAngle + +**optional** _number_ _default:_ `-Math.PI / 2` + +配置坐标系的起始角度。 + +#### endAngle + +**optional** _number_ _default:_ `Math.PI / 2 * 3` + +配置坐标系的结束角度。 + + + #### maxAngle **可选** _number_ _default:_ `240` diff --git a/docs/common/axis.zh.md b/docs/common/axis.zh.md index cd79585006..d195061206 100644 --- a/docs/common/axis.zh.md +++ b/docs/common/axis.zh.md @@ -1,3 +1,25 @@ +##### position + +**optional** _`top` | `bottom` | `left` | `right`_ + +适用于直角坐标系,设置坐标轴的位置。 + +### label + + _AxisLabelCfg | null_ **optional** + +文本标签的配置项,null 表示不展示。_AxisLabelCfg_ 配置如下: + +| 参数名 | 类型 | 是否必选 | 默认值 | 描述 | +| ------------ | ------------------------------------------------------ | -------- | ------- | ------------------------ | +| style | [ShapeAttrs](/zh/docs/api/shape/shape-attrs) | | - | 坐标轴刻度线的样式配置项 | +| offset | number | | - | label 的偏移量 | +| rotate | number | | - | 文本旋转角度 | +| autoRotate | boolean | | `true` | 是否自动旋转 | +| autoHide | boolean | | `false` | 是否自动隐藏 | +| autoEllipsis | boolean | | `false` | 是否自动省略 | +| formatter | `(text: string, item: ListItem, index: number) => any` | | `false` | 格式化函数 | + ##### nice **optional** _boolean_ _default:_ `true` @@ -46,12 +68,6 @@ 指定 tick 计算方法,或自定义计算 tick 的方法,内置 tick 计算方法包括 `cat`、`time-cat`、 `wilkinson-extended`、`r-pretty`、`time`、`time-pretty`、`log`、`pow`、`quantile`、`d3-linear`。 -##### position - -**optional** _`top` | `bottom` | `left` | `right`_ - -适用于直角坐标系,设置坐标轴的位置。 - ##### line **optional** _object_ diff --git a/examples/more-plots/radial-bar/demo/line.ts b/examples/more-plots/radial-bar/demo/line.ts index 3c2de75141..c473017e0d 100644 --- a/examples/more-plots/radial-bar/demo/line.ts +++ b/examples/more-plots/radial-bar/demo/line.ts @@ -17,8 +17,11 @@ const bar = new RadialBar('container', { data, xField: 'term', yField: 'count', - radius: 0.8, - innerRadius: 0.2, + radius: 1, + innerRadius: 0.4, + // 设置坐标系的起始角度和终止角度 + startAngle: Math.PI * 0.5, + endAngle: Math.PI * 2.5, tooltip: { showMarkers: true, },