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, }, 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